@testcontainers/influxdb 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +9 -0
- package/build/influxdb1-container.d.ts +32 -0
- package/build/influxdb1-container.js +92 -0
- package/build/influxdb2-container.d.ts +32 -0
- package/build/influxdb2-container.js +96 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 - 2025 Cristian Greco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Testcontainers
|
|
2
|
+
|
|
3
|
+
[](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=116414510&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUs)
|
|
4
|
+
|
|
5
|
+
[](https://github.com/testcontainers/testcontainers-node/actions/workflows/checks.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/testcontainers)
|
|
7
|
+
[](https://www.npmjs.com/package/testcontainers)
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## [📖 Documentation](https://node.testcontainers.org/)
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
See [LICENSE](https://github.com/testcontainers/testcontainers-node/blob/main/LICENSE).
|
|
16
|
+
|
|
17
|
+
## Copyright
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2018 - 2025 Cristian Greco and other authors.
|
|
20
|
+
|
|
21
|
+
## Contributing
|
|
22
|
+
|
|
23
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute to this repo.
|
|
24
|
+
|
|
25
|
+
See [contributors](https://github.com/testcontainers/testcontainers-node/graphs/contributors/) for all contributors.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Join our [Slack workspace](https://slack.testcontainers.org/) | [Testcontainers OSS](https://java.testcontainers.org/) | [Testcontainers Cloud](https://www.testcontainers.cloud/)
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StartedInfluxDB2Container = exports.InfluxDB2Container = exports.StartedInfluxDB1Container = exports.InfluxDB1Container = void 0;
|
|
4
|
+
var influxdb1_container_1 = require("./influxdb1-container");
|
|
5
|
+
Object.defineProperty(exports, "InfluxDB1Container", { enumerable: true, get: function () { return influxdb1_container_1.InfluxDB1Container; } });
|
|
6
|
+
Object.defineProperty(exports, "StartedInfluxDB1Container", { enumerable: true, get: function () { return influxdb1_container_1.StartedInfluxDB1Container; } });
|
|
7
|
+
var influxdb2_container_1 = require("./influxdb2-container");
|
|
8
|
+
Object.defineProperty(exports, "InfluxDB2Container", { enumerable: true, get: function () { return influxdb2_container_1.InfluxDB2Container; } });
|
|
9
|
+
Object.defineProperty(exports, "StartedInfluxDB2Container", { enumerable: true, get: function () { return influxdb2_container_1.StartedInfluxDB2Container; } });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AbstractStartedContainer, GenericContainer, StartedTestContainer } from "testcontainers";
|
|
2
|
+
export declare class InfluxDB1Container extends GenericContainer {
|
|
3
|
+
private database;
|
|
4
|
+
private username;
|
|
5
|
+
private password;
|
|
6
|
+
private authEnabled;
|
|
7
|
+
private adminUsername;
|
|
8
|
+
private adminPassword;
|
|
9
|
+
constructor(image: string);
|
|
10
|
+
withDatabase(database: string): this;
|
|
11
|
+
withUsername(username: string): this;
|
|
12
|
+
withPassword(password: string): this;
|
|
13
|
+
withAuthEnabled(authEnabled: boolean): this;
|
|
14
|
+
withAdminUsername(adminUsername: string): this;
|
|
15
|
+
withAdminPassword(adminPassword: string): this;
|
|
16
|
+
start(): Promise<StartedInfluxDB1Container>;
|
|
17
|
+
}
|
|
18
|
+
export declare class StartedInfluxDB1Container extends AbstractStartedContainer {
|
|
19
|
+
private readonly database;
|
|
20
|
+
private readonly username;
|
|
21
|
+
private readonly password;
|
|
22
|
+
private readonly adminUsername;
|
|
23
|
+
private readonly adminPassword;
|
|
24
|
+
constructor(startedTestContainer: StartedTestContainer, database: string, username: string, password: string, adminUsername: string, adminPassword: string);
|
|
25
|
+
getPort(): number;
|
|
26
|
+
getUrl(): string;
|
|
27
|
+
getDatabase(): string;
|
|
28
|
+
getUsername(): string;
|
|
29
|
+
getPassword(): string;
|
|
30
|
+
getAdminUsername(): string;
|
|
31
|
+
getAdminPassword(): string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StartedInfluxDB1Container = exports.InfluxDB1Container = void 0;
|
|
4
|
+
const testcontainers_1 = require("testcontainers");
|
|
5
|
+
const INFLUXDB_PORT = 8086;
|
|
6
|
+
class InfluxDB1Container extends testcontainers_1.GenericContainer {
|
|
7
|
+
database = "test";
|
|
8
|
+
username = "test-user";
|
|
9
|
+
password = "test-password";
|
|
10
|
+
authEnabled = true;
|
|
11
|
+
adminUsername = "admin";
|
|
12
|
+
adminPassword = "admin-password";
|
|
13
|
+
constructor(image) {
|
|
14
|
+
super(image);
|
|
15
|
+
this.withExposedPorts(INFLUXDB_PORT)
|
|
16
|
+
.withWaitStrategy(testcontainers_1.Wait.forHttp("/ping", INFLUXDB_PORT).forStatusCode(204))
|
|
17
|
+
.withStartupTimeout(120_000);
|
|
18
|
+
}
|
|
19
|
+
withDatabase(database) {
|
|
20
|
+
this.database = database;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
withUsername(username) {
|
|
24
|
+
this.username = username;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
withPassword(password) {
|
|
28
|
+
this.password = password;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
withAuthEnabled(authEnabled) {
|
|
32
|
+
this.authEnabled = authEnabled;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
withAdminUsername(adminUsername) {
|
|
36
|
+
this.adminUsername = adminUsername;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
withAdminPassword(adminPassword) {
|
|
40
|
+
this.adminPassword = adminPassword;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
async start() {
|
|
44
|
+
this.withEnvironment({
|
|
45
|
+
INFLUXDB_DB: this.database,
|
|
46
|
+
INFLUXDB_HTTP_AUTH_ENABLED: String(this.authEnabled),
|
|
47
|
+
INFLUXDB_ADMIN_USER: this.adminUsername,
|
|
48
|
+
INFLUXDB_ADMIN_PASSWORD: this.adminPassword,
|
|
49
|
+
INFLUXDB_USER: this.username,
|
|
50
|
+
INFLUXDB_USER_PASSWORD: this.password,
|
|
51
|
+
});
|
|
52
|
+
return new StartedInfluxDB1Container(await super.start(), this.database, this.username, this.password, this.adminUsername, this.adminPassword);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.InfluxDB1Container = InfluxDB1Container;
|
|
56
|
+
class StartedInfluxDB1Container extends testcontainers_1.AbstractStartedContainer {
|
|
57
|
+
database;
|
|
58
|
+
username;
|
|
59
|
+
password;
|
|
60
|
+
adminUsername;
|
|
61
|
+
adminPassword;
|
|
62
|
+
constructor(startedTestContainer, database, username, password, adminUsername, adminPassword) {
|
|
63
|
+
super(startedTestContainer);
|
|
64
|
+
this.database = database;
|
|
65
|
+
this.username = username;
|
|
66
|
+
this.password = password;
|
|
67
|
+
this.adminUsername = adminUsername;
|
|
68
|
+
this.adminPassword = adminPassword;
|
|
69
|
+
}
|
|
70
|
+
getPort() {
|
|
71
|
+
return this.getMappedPort(INFLUXDB_PORT);
|
|
72
|
+
}
|
|
73
|
+
getUrl() {
|
|
74
|
+
return `http://${this.getHost()}:${this.getPort()}`;
|
|
75
|
+
}
|
|
76
|
+
getDatabase() {
|
|
77
|
+
return this.database;
|
|
78
|
+
}
|
|
79
|
+
getUsername() {
|
|
80
|
+
return this.username;
|
|
81
|
+
}
|
|
82
|
+
getPassword() {
|
|
83
|
+
return this.password;
|
|
84
|
+
}
|
|
85
|
+
getAdminUsername() {
|
|
86
|
+
return this.adminUsername;
|
|
87
|
+
}
|
|
88
|
+
getAdminPassword() {
|
|
89
|
+
return this.adminPassword;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.StartedInfluxDB1Container = StartedInfluxDB1Container;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AbstractStartedContainer, GenericContainer, StartedTestContainer } from "testcontainers";
|
|
2
|
+
export declare class InfluxDB2Container extends GenericContainer {
|
|
3
|
+
private username;
|
|
4
|
+
private password;
|
|
5
|
+
private organization;
|
|
6
|
+
private bucket;
|
|
7
|
+
private retention?;
|
|
8
|
+
private adminToken;
|
|
9
|
+
constructor(image: string);
|
|
10
|
+
withUsername(username: string): this;
|
|
11
|
+
withPassword(password: string): this;
|
|
12
|
+
withOrganization(organization: string): this;
|
|
13
|
+
withBucket(bucket: string): this;
|
|
14
|
+
withRetention(retention: string): this;
|
|
15
|
+
withAdminToken(adminToken: string): this;
|
|
16
|
+
start(): Promise<StartedInfluxDB2Container>;
|
|
17
|
+
}
|
|
18
|
+
export declare class StartedInfluxDB2Container extends AbstractStartedContainer {
|
|
19
|
+
private readonly username;
|
|
20
|
+
private readonly password;
|
|
21
|
+
private readonly organization;
|
|
22
|
+
private readonly bucket;
|
|
23
|
+
private readonly adminToken;
|
|
24
|
+
constructor(startedTestContainer: StartedTestContainer, username: string, password: string, organization: string, bucket: string, adminToken: string);
|
|
25
|
+
getPort(): number;
|
|
26
|
+
getUrl(): string;
|
|
27
|
+
getUsername(): string;
|
|
28
|
+
getPassword(): string;
|
|
29
|
+
getOrganization(): string;
|
|
30
|
+
getBucket(): string;
|
|
31
|
+
getAdminToken(): string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StartedInfluxDB2Container = exports.InfluxDB2Container = void 0;
|
|
4
|
+
const testcontainers_1 = require("testcontainers");
|
|
5
|
+
const INFLUXDB_PORT = 8086;
|
|
6
|
+
class InfluxDB2Container extends testcontainers_1.GenericContainer {
|
|
7
|
+
username = "test-user";
|
|
8
|
+
password = "test-password";
|
|
9
|
+
organization = "test-org";
|
|
10
|
+
bucket = "test-bucket";
|
|
11
|
+
retention;
|
|
12
|
+
adminToken = "test-token";
|
|
13
|
+
constructor(image) {
|
|
14
|
+
super(image);
|
|
15
|
+
this.withExposedPorts(INFLUXDB_PORT)
|
|
16
|
+
.withWaitStrategy(testcontainers_1.Wait.forHttp("/ping", INFLUXDB_PORT).forStatusCode(204))
|
|
17
|
+
.withStartupTimeout(120_000);
|
|
18
|
+
}
|
|
19
|
+
withUsername(username) {
|
|
20
|
+
this.username = username;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
withPassword(password) {
|
|
24
|
+
this.password = password;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
withOrganization(organization) {
|
|
28
|
+
this.organization = organization;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
withBucket(bucket) {
|
|
32
|
+
this.bucket = bucket;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
withRetention(retention) {
|
|
36
|
+
this.retention = retention;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
withAdminToken(adminToken) {
|
|
40
|
+
this.adminToken = adminToken;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
async start() {
|
|
44
|
+
if (this.password.length < 8) {
|
|
45
|
+
throw new Error("InfluxDB 2.x password must be at least 8 characters long");
|
|
46
|
+
}
|
|
47
|
+
this.withEnvironment({
|
|
48
|
+
DOCKER_INFLUXDB_INIT_MODE: "setup",
|
|
49
|
+
DOCKER_INFLUXDB_INIT_USERNAME: this.username,
|
|
50
|
+
DOCKER_INFLUXDB_INIT_PASSWORD: this.password,
|
|
51
|
+
DOCKER_INFLUXDB_INIT_ORG: this.organization,
|
|
52
|
+
DOCKER_INFLUXDB_INIT_BUCKET: this.bucket,
|
|
53
|
+
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: this.adminToken,
|
|
54
|
+
...(this.retention !== undefined ? { DOCKER_INFLUXDB_INIT_RETENTION: this.retention } : {}),
|
|
55
|
+
});
|
|
56
|
+
return new StartedInfluxDB2Container(await super.start(), this.username, this.password, this.organization, this.bucket, this.adminToken);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.InfluxDB2Container = InfluxDB2Container;
|
|
60
|
+
class StartedInfluxDB2Container extends testcontainers_1.AbstractStartedContainer {
|
|
61
|
+
username;
|
|
62
|
+
password;
|
|
63
|
+
organization;
|
|
64
|
+
bucket;
|
|
65
|
+
adminToken;
|
|
66
|
+
constructor(startedTestContainer, username, password, organization, bucket, adminToken) {
|
|
67
|
+
super(startedTestContainer);
|
|
68
|
+
this.username = username;
|
|
69
|
+
this.password = password;
|
|
70
|
+
this.organization = organization;
|
|
71
|
+
this.bucket = bucket;
|
|
72
|
+
this.adminToken = adminToken;
|
|
73
|
+
}
|
|
74
|
+
getPort() {
|
|
75
|
+
return this.getMappedPort(INFLUXDB_PORT);
|
|
76
|
+
}
|
|
77
|
+
getUrl() {
|
|
78
|
+
return `http://${this.getHost()}:${this.getPort()}`;
|
|
79
|
+
}
|
|
80
|
+
getUsername() {
|
|
81
|
+
return this.username;
|
|
82
|
+
}
|
|
83
|
+
getPassword() {
|
|
84
|
+
return this.password;
|
|
85
|
+
}
|
|
86
|
+
getOrganization() {
|
|
87
|
+
return this.organization;
|
|
88
|
+
}
|
|
89
|
+
getBucket() {
|
|
90
|
+
return this.bucket;
|
|
91
|
+
}
|
|
92
|
+
getAdminToken() {
|
|
93
|
+
return this.adminToken;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.StartedInfluxDB2Container = StartedInfluxDB2Container;
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@testcontainers/influxdb",
|
|
3
|
+
"version": "12.2.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"influxdb",
|
|
7
|
+
"influx",
|
|
8
|
+
"timeseries",
|
|
9
|
+
"testing",
|
|
10
|
+
"docker",
|
|
11
|
+
"testcontainers"
|
|
12
|
+
],
|
|
13
|
+
"description": "InfluxDB module for Testcontainers",
|
|
14
|
+
"homepage": "https://github.com/testcontainers/testcontainers-node#readme",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/testcontainers/testcontainers-node.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/testcontainers/testcontainers-node/issues"
|
|
21
|
+
},
|
|
22
|
+
"main": "build/index.js",
|
|
23
|
+
"files": [
|
|
24
|
+
"build"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"prepack": "shx cp ../../../README.md . && shx cp ../../../LICENSE .",
|
|
31
|
+
"build": "tsc --project tsconfig.build.json"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@influxdata/influxdb-client": "^1.35.0"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"testcontainers": "^12.2.0"
|
|
38
|
+
}
|
|
39
|
+
}
|