Skip to content

Commit b0184ec

Browse files
committed
Add test with load-balancing
1 parent 47ced02 commit b0184ec

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/v1-promise.test.ts

Lines changed: 27 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 () => {
@@ -623,4 +624,30 @@ describe("Experimental Service", () => {
623624

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

0 commit comments

Comments
 (0)