Skip to content
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

[TEST] added test verifying that new consumer creation accepts durable_name and name when same, and rejects when different. #360

Merged
merged 1 commit into from
Sep 14, 2022
Merged
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
39 changes: 39 additions & 0 deletions tests/jsm_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1410,3 +1410,42 @@ Deno.test("jsm - mirror_direct options", async () => {

await cleanup(ns, nc);
});

Deno.test("jsm - consumers with name and durable_name", async () => {
const { ns, nc } = await setup(
jetstreamServerConf({}, true),
);

if (await notCompatible(ns, nc, "2.9.0")) {
return;
}

// change the version of the server to force legacy apis
const jsm = await nc.jetstreamManager();
await jsm.streams.add({
name: "A",
subjects: ["foo", "bar"],
});

// should be ok
await jsm.consumers.add("A", {
name: "x",
durable_name: "x",
ack_policy: AckPolicy.None,
});

// should fail from the server
await assertRejects(
async () => {
await jsm.consumers.add("A", {
name: "y",
durable_name: "z",
ack_policy: AckPolicy.None,
});
},
Error,
"consumer name in subject does not match durable name in request",
);

await cleanup(ns, nc);
});