Skip to content

Commit d615abf

Browse files
committed
Add test with load-balancing
1 parent fdf7660 commit d615abf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/v1-promise.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
WriteSchemaRequest,
2222
} from './v1.js';
2323
import { describe, it, expect, beforeEach } from 'vitest'
24+
import {PreconnectServices} from './util.js';
2425

2526
describe('a check with an unknown namespace', () => {
2627
it('should raise a failed precondition', async () => {
@@ -618,4 +619,28 @@ describe('Experimental Service', () => {
618619

619620
client.close();
620621
});
622+
describe("load balancing configuration", () => {
623+
it("can use round-robin load balancing", async () => {
624+
const { promises: client } = NewClient(
625+
generateTestToken('v1-promise-namespace'),
626+
'localhost:50051',
627+
ClientSecurity.INSECURE_LOCALHOST_ALLOWED,
628+
PreconnectServices.SCHEMA_SERVICE,
629+
{'grpc.service_config': JSON.stringify({
630+
loadBalancingConfig: [{ round_robin: {} }],
631+
})}
632+
);
633+
634+
const schemaResponse = await client.writeSchema({
635+
schema: `definition test/user {}
636+
637+
definition test/document {
638+
relation viewer: test/user
639+
permission view = viewer
640+
}
641+
`,
642+
});
643+
expect(schemaResponse).toBeTruthy();
644+
})
645+
})
621646
});

0 commit comments

Comments
 (0)