-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add InfluxDB v2 support #3669
Add InfluxDB v2 support #3669
Changes from 75 commits
1d7a20f
60d8970
3aa16a5
898b4a9
3ea5560
5ce658b
dc56931
d70ed4d
31ecbe3
41e366a
9c3b224
0be00c9
11ed5d4
b5e5224
1dd2101
56887b0
29c5605
79d6dce
b4ba6bf
9bc928e
c4a23f3
66e507a
f6db3fe
5021425
0f52423
d606cb1
56b53c1
2f8fdbc
dfe23b6
fd0dec4
1b4ad56
e67fc5a
77f2bac
104f88f
9526fb3
b1a84a1
08af825
7d5d03d
548713b
53414ca
22090c7
afa957f
2c03dda
89118fc
207de33
5250407
9d57417
da508d0
fb86e07
31e3ab0
bba98d8
0d99d8d
8f56b21
cc1fc1a
6df5da2
37bfd1f
3ff5ec2
0dee636
2fdd745
30d5a80
e526c77
c3f354c
576cc04
ae27fc3
8c8ec4d
335fbbd
88f9847
8e1442d
d99342c
b92b63d
edfc72c
95dada5
f03ac43
ccb1dac
4b365b0
a1d1245
cb0c2c0
8ba2714
8f6f2a5
773328c
aa1e2ca
1d817fe
adab811
8a190d0
627a01c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,93 @@ | ||
# InfluxDB Module | ||
|
||
Testcontainers module for InfluxData [InfluxDB](https://github.com/influxdata/influxdb). | ||
Testcontainers module for InfluxData [InfluxDB](https://www.influxdata.com/products/influxdb/). | ||
|
||
## Usage example | ||
## Important note | ||
|
||
Running influxDbContainer as a stand-in for InfluxDB in a test: | ||
There are breaking changes in InfluxDB 2.x. | ||
For more information refer to the main [documentation](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/). | ||
You can find more information about the official InfluxDB image on [Docker Hub](https://hub.docker.com/_/influxdb). | ||
|
||
```java | ||
public class SomeTest { | ||
## InfluxDB 2.x usage example | ||
|
||
@Rule | ||
public InfluxDBContainer influxDbContainer = new InfluxDBContainer(); | ||
|
||
@Test | ||
public void someTestMethod() { | ||
InfluxDB influxDB = influxDbContainer.getNewInfluxDB(); | ||
... | ||
``` | ||
Running a `InfluxDBContainer` as a stand-in for InfluxDB in a test: | ||
|
||
<!--codeinclude--> | ||
[InfluxDBContainerTest](../../../modules/influxdb/src/test/java/org/testcontainers/containers/InfluxDBContainerTest.java) | ||
<!--/codeinclude--> | ||
raminqaf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
The InfluxDB instance will be setup with the following data:<br/> | ||
|
||
| Property | Default Value | | ||
|--------------|:-------------:| | ||
| username | test-user | | ||
| password | test-password | | ||
| organization | test-org | | ||
| bucket | test-bucket | | ||
| retention | 0 (infinite) | | ||
| adminToken | - | | ||
|
||
For more details about the InfluxDB setup, please visit the official [InfluxDB documentation](https://docs.influxdata.com/influxdb/v2.0/upgrade/v1-to-v2/docker/#influxdb-2x-initialization-credentials). | ||
|
||
In the following example you will find a snippet to create an InfluxDB client using the official Java client: | ||
|
||
<!--codeinclude--> | ||
[InfluxDBTestUtils.getInfluxDBClient()](../../../modules/influxdb/src/test/java/org/testcontainers/containers/InfluxDBTestUtils.java) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here about use the code that is required |
||
<!--/codeinclude--> | ||
|
||
!!! hint | ||
You can find the latest documentation about the InfluxDB 2.x Java client [here](https://github.com/influxdata/influxdb-client-java). | ||
|
||
## InfluxDB 1.x usage example | ||
|
||
Running a `InfluxDBContainer` as a stand-in for InfluxDB in a test: | ||
|
||
<!--codeinclude--> | ||
[InfluxDBContainerV1Test](../../../modules/influxdb/src/test/java/org/testcontainers/containers/InfluxDBContainerV1Test.java) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here about use the code that is required |
||
<!--/codeinclude--> | ||
|
||
The InfluxDB instance will be setup with the following data:<br/> | ||
|
||
| Property | Default Value | | ||
|---------------|:-------------:| | ||
| username | test-user | | ||
| password | test-password | | ||
| authEnabled | true | | ||
| admin | admin | | ||
| adminPassword | password | | ||
| database | - | | ||
|
||
In the following example you will find a snippet to create an InfluxDB client using the official Java client: | ||
|
||
<!--codeinclude--> | ||
[InfluxDBContainer.getNewInfluxDB()](../../../modules/influxdb/src/main/java/org/testcontainers/containers/InfluxDBContainer.java) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here about use the code that is required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing the block here too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done ✅ |
||
<!--/codeinclude--> | ||
|
||
!!! hint | ||
You can find the latest documentation about the InfluxDB 1.x Java client [here](https://github.com/influxdata/influxdb-java). | ||
|
||
## Adding this module to your project dependencies | ||
|
||
Add the following dependency to your `pom.xml`/`build.gradle` file: | ||
|
||
=== "Gradle" | ||
```groovy | ||
testImplementation "org.testcontainers:influxdb:{{latest_version}}" | ||
``` | ||
|
||
```groovy | ||
testImplementation "org.testcontainers:influxdb:{{latest_version}}" | ||
``` | ||
|
||
=== "Maven" | ||
```xml | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>influxdb</artifactId> | ||
<version>{{latest_version}}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
```xml | ||
|
||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>influxdb</artifactId> | ||
<version>{{latest_version}}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` | ||
|
||
!!! hint | ||
Adding this Testcontainers library JAR will not automatically add a database driver JAR to your project. You should ensure that your project also has a suitable database driver as a dependency. | ||
raminqaf marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the whole test class is included in the docs. Use blocks in order to use only what is required. See https://github.com/testcontainers/testcontainers-java/blob/main/docs/modules/pulsar.md?plain=1#L11-L13 and https://github.com/testcontainers/testcontainers-java/blob/main/modules/pulsar/src/test/java/org/testcontainers/containers/PulsarContainerTest.java#L32-L34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eddumelendez Done!