Skip to content
Closed
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
17 changes: 11 additions & 6 deletions packages/shell-api/src/shard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3216,6 +3216,10 @@ describe('Shard', function () {
let db: Database;
let hasTotalSize: boolean;
let hasScaleFactorIncluded: boolean;
// Server 9.0 makes timeseries collections viewless: there is no separate
// system.buckets.<coll> namespace anymore, so bucketsNs is the collection
// namespace itself.
let isTimeseriesViewless: boolean;
Comment on lines +3219 to +3222
const dbName = 'shard-stats-test';
const ns = `${dbName}.test`;

Expand All @@ -3226,6 +3230,8 @@ describe('Shard', function () {
const dbVersion = await db.version();
hasTotalSize = !/^4\.[0123]\./.exec(dbVersion);
hasScaleFactorIncluded = !/^4\.[01]\./.exec(dbVersion);
isTimeseriesViewless =
Number.parseInt(dbVersion.split('.')[0], 10) >= 9;
Comment on lines +3233 to +3234
});
afterEach(async function () {
await db.dropDatabase();
Expand Down Expand Up @@ -3410,18 +3416,17 @@ describe('Shard', function () {
// Timeseries bucket collection does not provide 'count' or 'avgObjSize'.
expect(result.count).to.equal(undefined);
expect(result.primary).to.equal(undefined);
const expectedBucketsNs = isTimeseriesViewless
? `${dbName}.${timeseriesCollectionName}`
: `${dbName}.system.buckets.${timeseriesCollectionName}`;
for (const shard of Object.values(result.shards) as any) {
expect(shard.totalSize).to.be.a('number');
expect(shard.indexDetails).to.equal(undefined);
expect(shard.timeseries.bucketsNs).to.equal(
`${dbName}.system.buckets.${timeseriesCollectionName}`
);
expect(shard.timeseries.bucketsNs).to.equal(expectedBucketsNs);
Comment on lines +3419 to +3425
expect(shard.timeseries.numBucketUpdates).to.equal(0);
expect(typeof result.timeseries.bucketCount).to.equal('number');
}
expect(result.timeseries.bucketsNs).to.equal(
`${dbName}.system.buckets.${timeseriesCollectionName}`
);
expect(result.timeseries.bucketsNs).to.equal(expectedBucketsNs);
expect(result.timeseries.bucketCount).to.equal(1);
expect(result.timeseries.numBucketInserts).to.equal(1);
});
Expand Down
Loading