Skip to content

Commit 5c1f95f

Browse files
authored
Merge pull request #719 from nats-io/test-717
[TEST] added test to cover fix for #717
2 parents 115c68e + 9f6b7e3 commit 5c1f95f

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

jetstream/objectstore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ export class ObjectStoreImpl implements ObjectStore {
788788
// pacify the tsc compiler downstream
789789
const sc = Object.assign({ max_age }, opts) as unknown as StreamConfig;
790790
sc.name = this.stream;
791-
sc.num_replicas = opts.replicas ?? 1
791+
sc.num_replicas = opts.replicas ?? 1;
792792
sc.allow_direct = true;
793793
sc.allow_rollup_hdrs = true;
794794
sc.discard = DiscardPolicy.New;

jetstream/tests/objectstore_test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import {
1717
cleanup,
1818
jetstreamServerConf,
19+
NatsServer,
1920
notCompatible,
2021
setup,
2122
} from "../../tests/helpers/mod.ts";
@@ -29,7 +30,7 @@ import {
2930
import { DataBuffer } from "../../nats-base-client/databuffer.ts";
3031
import { crypto } from "https://deno.land/[email protected]/crypto/mod.ts";
3132
import { ObjectInfo, ObjectStoreMeta, StorageType } from "../mod.ts";
32-
import { Empty, headers, nanos, StringCodec } from "../../src/mod.ts";
33+
import { connect, Empty, headers, nanos, StringCodec } from "../../src/mod.ts";
3334
import { equals } from "https://deno.land/[email protected]/bytes/mod.ts";
3435
import { SHA256 } from "../../nats-base-client/sha256.js";
3536
import { Base64UrlPaddedCodec } from "../../nats-base-client/base64.ts";
@@ -1113,3 +1114,15 @@ Deno.test("os - compression", async () => {
11131114
assertEquals(status.compression, false);
11141115
await cleanup(ns, nc);
11151116
});
1117+
1118+
Deno.test("os - replicas", async () => {
1119+
const servers = await NatsServer.jetstreamCluster(3);
1120+
const nc = await connect({ port: servers[0].port });
1121+
1122+
const js = nc.jetstream();
1123+
const os = await js.views.os("rep", { replicas: 3 });
1124+
const status = await os.status();
1125+
assertEquals(status.replicas, 3);
1126+
await nc.close();
1127+
await NatsServer.stopAll(servers);
1128+
});

0 commit comments

Comments
 (0)