Skip to content

Commit 8fe4682

Browse files
authored
Merge pull request #705 from arangodb/bug-fix/wait-for-analyzers-only-if-37-or-higher
don't wait for analyzer propagation in 3.6, as it will likely time out
2 parents 1ad9cd6 + bdf1316 commit 8fe4682

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

src/test/28-accessing-analyzers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe35("Accessing analyzers", function () {
4646
await analyzer.create({ type: "identity" });
4747
await db.waitForPropagation(
4848
{ path: `/_api/analyzer/${analyzer.name}` },
49-
30000
49+
65000
5050
);
5151
})
5252
);
@@ -74,7 +74,7 @@ describe35("Accessing analyzers", function () {
7474
await analyzer.create({ type: "identity" });
7575
await db.waitForPropagation(
7676
{ path: `/_api/analyzer/${analyzer.name}` },
77-
30000
77+
65000
7878
);
7979
})
8080
);

src/test/29-manipulating-analyzers.ts

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ import { config } from "./_config";
55

66
const describe35 = config.arangoVersion! >= 30500 ? describe : describe.skip;
77

8+
function waitForAnalyzer(db: Database, name: string) {
9+
if (config.arangoVersion >= 30700) {
10+
// analyzer propagation in the cluster has an up-to 60 seconds
11+
// delay in 3.6. this is changed in 3.7, and analyzer changes
12+
// are replicated near-instantaneously via the agency in 3.7+
13+
return db.waitForPropagation(
14+
{ path: `/_api/analyzer/${name}` },
15+
30000
16+
);
17+
} else {
18+
// make a call only to /_api/version in the target database, as
19+
// we can't be sure analyzers will be propagated in time
20+
return db.waitForPropagation(
21+
{ path: `/_api/version` },
22+
10000
23+
);
24+
}
25+
}
26+
827
describe35("Manipulating analyzers", function () {
928
const name = `testdb_${Date.now()}`;
1029
let db: Database;
@@ -27,10 +46,7 @@ describe35("Manipulating analyzers", function () {
2746
const analyzer = db.analyzer(`a_${Date.now()}`);
2847
expect(await analyzer.exists()).to.equal(false);
2948
await analyzer.create({ type: "identity" });
30-
await db.waitForPropagation(
31-
{ path: `/_api/analyzer/${analyzer.name}` },
32-
30000
33-
);
49+
await waitForAnalyzer(db, analyzer.name);
3450
expect(await analyzer.exists()).to.equal(true);
3551
});
3652
});
@@ -39,10 +55,7 @@ describe35("Manipulating analyzers", function () {
3955
before(async () => {
4056
analyzer = db.analyzer(`a_${Date.now()}`);
4157
await analyzer.create({ type: "identity" });
42-
await db.waitForPropagation(
43-
{ path: `/_api/analyzer/${analyzer.name}` },
44-
30000
45-
);
58+
await waitForAnalyzer(db, analyzer.name);
4659
});
4760
after(async () => {
4861
try {
@@ -58,10 +71,7 @@ describe35("Manipulating analyzers", function () {
5871
it("creates the analyzer", async () => {
5972
const analyzer = db.analyzer(`a_${Date.now()}`);
6073
await analyzer.create({ type: "identity" });
61-
await db.waitForPropagation(
62-
{ path: `/_api/analyzer/${analyzer.name}` },
63-
30000
64-
);
74+
await waitForAnalyzer(db, analyzer.name);
6575
const data = await analyzer.get();
6676
expect(data).to.have.property("name", `${name}::${analyzer.name}`);
6777
expect(data).to.have.property("type", "identity");
@@ -71,10 +81,7 @@ describe35("Manipulating analyzers", function () {
7181
it("destroys the analyzer", async () => {
7282
const analyzer = db.analyzer(`a_${Date.now()}`);
7383
await analyzer.create({ type: "identity" });
74-
await db.waitForPropagation(
75-
{ path: `/_api/analyzer/${analyzer.name}` },
76-
30000
77-
);
84+
await waitForAnalyzer(db, analyzer.name);
7885
await analyzer.drop();
7986
expect(await analyzer.exists()).to.equal(false);
8087
});

0 commit comments

Comments
 (0)