Skip to content

Commit 07e575c

Browse files
committed
fix stats tests for 4.2
1 parent 242c4ad commit 07e575c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

test/Documents/Commands/GetStatisticsCommandTests.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ describe("GetStatisticsCommand()", function () {
3434
assert.ok(stats.lastDocEtag);
3535
assert.ok(stats.lastDocEtag > 0);
3636

37-
assert.strictEqual(stats.countOfIndexes, 3);
37+
if (testContext.serverVersion === "4.1") {
38+
assert.strictEqual(stats.countOfIndexes, 3);
39+
} else {
40+
assert.strictEqual(stats.countOfIndexes, 4);
41+
}
42+
3843
assert.strictEqual(stats.countOfDocuments, 1059);
3944
assert.ok(stats.countOfRevisionDocuments > 0);
4045
assert.strictEqual(stats.countOfDocumentsConflicts, 0);

test/TestDriver/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ const log = getLogger({ module: "TestDriver" });
2828

2929
export abstract class RavenTestDriver implements IDisposable {
3030

31+
private _serverVersion: string;
32+
33+
public get serverVersion() {
34+
return this._serverVersion;
35+
}
36+
3137
private readonly _locator: RavenServerLocator;
3238
private readonly _securedLocator: RavenServerLocator;
3339

@@ -194,6 +200,7 @@ export abstract class RavenTestDriver implements IDisposable {
194200
});
195201

196202
const scrapServerUrl = () => {
203+
const SERVER_VERSION_REGEX = /Version (4.\d)/;
197204
const SERVER_URL_REGEX = /Server available on:\s*(\S+)\s*$/m;
198205
const serverProcess = this._getGlobalProcess(secured);
199206
let serverOutput = "";
@@ -203,6 +210,12 @@ export abstract class RavenTestDriver implements IDisposable {
203210
serverProcess.stdout
204211
.on("data", (chunk) => {
205212
serverOutput += chunk;
213+
214+
const serverVersionMatch = serverOutput.match(SERVER_VERSION_REGEX);
215+
if (serverVersionMatch && serverVersionMatch.length) {
216+
this._serverVersion = serverVersionMatch[1];
217+
}
218+
206219
try {
207220
const regexMatch = serverOutput.match(SERVER_URL_REGEX);
208221
if (!regexMatch) {

0 commit comments

Comments
 (0)