Skip to content

Add test with load-balancing #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/v1-promise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
WriteSchemaRequest,
} from "./v1.js";
import { describe, it, expect, beforeEach } from "vitest";
import { PreconnectServices } from "./util.js";

describe("a check with an unknown namespace", () => {
it("should raise a failed precondition", async () => {
Expand Down Expand Up @@ -623,4 +624,30 @@

client.close();
});
describe("load balancing configuration", () => {
it("can use round-robin load balancing", async () => {
const { promises: client } = NewClient(
generateTestToken("v1-promise-namespace"),

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical

The hard-coded value "v1-promise-namespace" is used as
authorization header
.
"localhost:50051",
ClientSecurity.INSECURE_LOCALHOST_ALLOWED,
PreconnectServices.SCHEMA_SERVICE,
{
"grpc.service_config": JSON.stringify({
loadBalancingConfig: [{ round_robin: {} }],
}),
},
);

const schemaResponse = await client.writeSchema({
schema: `definition test/user {}

definition test/document {
relation viewer: test/user
permission view = viewer
}
`,
});
expect(schemaResponse).toBeTruthy();
});
});
});