Skip to content

Commit f09e7d6

Browse files
committed
Consistently use jenkins env vars
1 parent c332862 commit f09e7d6

28 files changed

+164
-134
lines changed

src/test/01-manipulating-databases.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ import { Database } from "../arangojs";
33
import { ArangoError } from "../error";
44

55
const range = (n: number): number[] => Array.from(Array(n).keys());
6-
const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30400);
6+
7+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
8+
const ARANGO_VERSION = Number(
9+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
10+
);
711
const it2x = ARANGO_VERSION < 30000 ? it : it.skip;
812

913
describe("Manipulating databases", function() {
1014
let db: Database;
1115
beforeEach(() => {
12-
db = new Database({
13-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
14-
arangoVersion: ARANGO_VERSION
15-
});
16+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1617
});
1718
afterEach(() => {
1819
db.close();

src/test/02-accessing-collections.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import { DocumentCollection, EdgeCollection } from "../collection";
44

55
const range = (n: number): number[] => Array.from(Array(n).keys());
66

7+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
8+
const ARANGO_VERSION = Number(
9+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
10+
);
11+
712
describe("Accessing collections", function() {
813
const name = `testdb_${Date.now()}`;
914
let db: Database;
1015
let builtinSystemCollections: string[];
1116
before(async () => {
12-
db = new Database({
13-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
14-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
15-
});
17+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1618
await db.createDatabase(name);
1719
db.useDatabase(name);
1820
const collections = await db.listCollections(false);

src/test/03-accessing-graphs.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import { Graph } from "../graph";
44

55
const range = (n: number): number[] => Array.from(Array(n).keys());
66

7+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
8+
const ARANGO_VERSION = Number(
9+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
10+
);
11+
712
describe("Accessing graphs", function() {
813
const name = `testdb_${Date.now()}`;
914
let db: Database;
1015
before(async () => {
11-
db = new Database({
12-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
13-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
14-
});
16+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1517
await db.createDatabase(name);
1618
db.useDatabase(name);
1719
});

src/test/04-transactions.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import { expect } from "chai";
22
import { Database } from "../arangojs";
33
import { DocumentCollection } from "../collection";
44

5+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
6+
const ARANGO_VERSION = Number(
7+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
8+
);
9+
const describe35 = ARANGO_VERSION >= 30500 ? describe : describe.skip;
10+
const itRdb = process.env.ARANGO_STORAGE_ENGINE !== "mmfiles" ? it : it.skip;
11+
512
describe("Transactions", () => {
613
let db: Database;
714
before(() => {
8-
db = new Database({
9-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
10-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
11-
});
15+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1216
});
1317
after(() => {
1418
db.close();

src/test/05-aql-helpers.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ describe("AQL helpers", function() {
1717
[1, 2, 3],
1818
{ a: "b" }
1919
];
20-
const query = aql`A ${values[0]} B ${values[1]} C ${values[2]} D ${
21-
values[3]
22-
} E ${values[4]} F ${values[5]} G ${values[6]} H ${values[7]} I ${
23-
values[8]
24-
} J ${values[9]} K EOF`;
20+
const query = aql`A ${values[0]} B ${values[1]} C ${values[2]} D ${values[3]} E ${values[4]} F ${values[5]} G ${values[6]} H ${values[7]} I ${values[8]} J ${values[9]} K EOF`;
2521
expect(query.query).to.equal(
2622
`A @value0 B @value1 C @value2 D @value3 E @value4 F @value5 G @value6 H @value7 I @value8 J @value9 K EOF`
2723
);
28-
const bindVarNames = Object.keys(query.bindVars).sort(
29-
(a, b) => (+a.substr(5) > +b.substr(5) ? 1 : -1)
24+
const bindVarNames = Object.keys(query.bindVars).sort((a, b) =>
25+
+a.substr(5) > +b.substr(5) ? 1 : -1
3026
);
3127
expect(bindVarNames).to.eql([
3228
"value0",

src/test/06-managing-functions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { expect } from "chai";
22
import { Database } from "../arangojs";
33

4-
const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30400);
4+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
5+
const ARANGO_VERSION = Number(
6+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
7+
);
58
const it34 = ARANGO_VERSION >= 30400 ? it : it.skip;
69

710
describe("Managing functions", function() {
811
const name = `testdb_${Date.now()}`;
912
let db: Database;
1013
before(async () => {
11-
db = new Database({
12-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
13-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
14-
});
14+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1515
await db.createDatabase(name);
1616
db.useDatabase(name);
1717
});

src/test/07-routes.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ import { Database } from "../arangojs";
33
import { DocumentCollection } from "../collection";
44
import { Route } from "../route";
55

6+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
7+
const ARANGO_VERSION = Number(
8+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
9+
);
10+
611
describe("Arbitrary HTTP routes", () => {
712
const db = new Database({
8-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
9-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
13+
url: ARANGO_URL,
14+
arangoVersion: ARANGO_VERSION
1015
});
1116
describe("database.route", () => {
1217
it("returns a Route instance", () => {
@@ -30,10 +35,7 @@ describe("Route API", function() {
3035
let db: Database;
3136
let collection: DocumentCollection;
3237
before(async () => {
33-
db = new Database({
34-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
35-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
36-
});
38+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
3739
await db.createDatabase(name);
3840
db.useDatabase(name);
3941
collection = db.collection(`c_${Date.now()}`);

src/test/08-cursors.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { expect } from "chai";
22
import { aql, Database } from "../arangojs";
33
import { ArrayCursor } from "../cursor";
44

5+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
6+
const ARANGO_VERSION = Number(
7+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
8+
);
9+
510
const aqlQuery = aql`FOR i In 0..10 RETURN i`;
611
const aqlResult = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
712

@@ -15,10 +20,7 @@ describe("Cursor API", () => {
1520
let db: Database;
1621
let cursor: ArrayCursor;
1722
before(() => {
18-
db = new Database({
19-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
20-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
21-
});
23+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
2224
});
2325
after(() => {
2426
db.close();

src/test/09-collection-metadata.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ import { expect } from "chai";
22
import { Database } from "../arangojs";
33
import { COLLECTION_NOT_FOUND, DocumentCollection } from "../collection";
44

5+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
6+
const ARANGO_VERSION = Number(
7+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
8+
);
9+
510
describe("Collection metadata", function() {
611
let db: Database;
712
let collection: DocumentCollection;
813
const dbName = `testdb_${Date.now()}`;
914
const collectionName = `collection-${Date.now()}`;
1015
before(async () => {
11-
db = new Database({
12-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
13-
arangoVersion: Number(process.env.ARANGO_VERSION || 30400)
14-
});
16+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1517
await db.createDatabase(dbName);
1618
db.useDatabase(dbName);
1719
collection = db.collection(collectionName);

src/test/10-manipulating-collections.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import { expect } from "chai";
22
import { Database } from "../arangojs";
33
import { DocumentCollection } from "../collection";
44

5-
const ARANGO_VERSION = Number(process.env.ARANGO_VERSION || 30400);
5+
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
6+
const ARANGO_VERSION = Number(
7+
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 30400
8+
);
69

710
describe("Manipulating collections", function() {
811
const name = `testdb_${Date.now()}`;
912
let db: Database;
1013
let collection: DocumentCollection;
1114
before(async () => {
12-
db = new Database({
13-
url: process.env.TEST_ARANGODB_URL || "http://localhost:8529",
14-
arangoVersion: ARANGO_VERSION
15-
});
15+
db = new Database({ url: ARANGO_URL, arangoVersion: ARANGO_VERSION });
1616
await db.createDatabase(name);
1717
db.useDatabase(name);
1818
});

0 commit comments

Comments
 (0)