You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/influxdb.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Since testcontainers-go <a href="https://github.com/testcontainers/testcontainer
4
4
5
5
## Introduction
6
6
7
-
A testcontainers module for InfluxDB. This module supports v1.x of InfluxDB.
7
+
A testcontainers module for InfluxDB V1 and V2.
8
8
9
9
## Adding this module to your project dependencies
10
10
@@ -16,8 +16,11 @@ go get github.com/testcontainers/testcontainers-go/modules/influxdb
16
16
17
17
## Usage example
18
18
19
+
### InfluxDB
20
+
19
21
<!--codeinclude-->
20
-
[Creating an InfluxDB container](../../modules/influxdb/examples_test.go) inside_block:runInfluxContainer
22
+
[Creating an InfluxDB V1 container](../../modules/influxdb/examples_test.go) inside_block:runInfluxContainer
23
+
[Creating an InfluxDB V2 container](../../modules/influxdb/examples_test.go) inside_block:runInfluxV2Container
21
24
<!--/codeinclude-->
22
25
23
26
## Module Reference
@@ -54,7 +57,7 @@ Use the second argument in the `Run` function to set a valid Docker image.
54
57
In example: `Run(context.Background(), "influxdb:1.8.0")`.
55
58
56
59
!!!info
57
-
Note that `influxdb:latest` will get you a version 2 image which is not supported by this module.
60
+
Note that `influxdb:latest` will pull a version 2 image.
58
61
59
62
{% include "../features/common_functional_options.md" %}
60
63
@@ -63,6 +66,20 @@ In example: `Run(context.Background(), "influxdb:1.8.0")`.
63
66
By default, authentication is disabled and no credentials are needed to use the InfluxAPI against the test container.
64
67
If you want to test with credentials, include the appropriate environment variables to do so.
65
68
69
+
#### ConfiguringInfluxDBV2
70
+
71
+
- Not available until the next release of testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>
72
+
73
+
When running the InfluxDBV2 image, you can override the default configuration by using options prefixed by `influxdb.WithV2`.
74
+
The following options are available:
75
+
76
+
- `WithV2(org, bucket string)`: Configures organization and bucket name. This option is required to run the InfluxDBV2 image.
77
+
- `WithV2Auth(org, bucket, username, password string)`: Sets the username and password for the initial user.
78
+
- `WithV2SecretsAuth(org, bucket, usernameFile, passwordFile string)`: Sets the username and password file path.
79
+
- `WithV2Retention(retention time.Duration)`: Sets the default bucket retention policy.
80
+
- `WithV2AdminToken(token string)`: Sets the admin token for the initial user.
81
+
- `WithV2SecretsAdminToken(tokenFile string)`: Sets the admin token file path.
82
+
66
83
#### InitScripts
67
84
68
85
While the InfluxDB image will obey the `/docker-entrypoint-initdb.d` directory as is common, that directory does not
0 commit comments