Skip to content

Commit 592a948

Browse files
committed
fix: linting
1 parent af4a9f8 commit 592a948

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { InfluxDBContainer, StartedInfluxDBContainer } from "./influxdb-container";
1+
export { InfluxDBContainer, StartedInfluxDBContainer } from "./influxdb-container";

packages/modules/influxdb/src/influxdb-container.test.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { InfluxDBContainer, StartedInfluxDBContainer } from "./influxdb-container";
2-
import { getImage } from "../../../testcontainers/src/utils/test-helper";
31
import axios from "axios";
2+
import { getImage } from "../../../testcontainers/src/utils/test-helper";
3+
import { InfluxDBContainer, StartedInfluxDBContainer } from "./influxdb-container";
44

55
const IMAGE = getImage(__dirname);
66

77
describe("InfluxDBContainer", { timeout: 240_000 }, () => {
8-
98
describe("InfluxDB 2.x", { timeout: 240_000 }, () => {
109
let container: StartedInfluxDBContainer;
1110

@@ -66,21 +65,19 @@ describe("InfluxDBContainer", { timeout: 240_000 }, () => {
6665

6766
it("should be able to write and query data", async () => {
6867
const adminToken = "test-admin-token";
69-
container = await new InfluxDBContainer(IMAGE)
70-
.withAdminToken(adminToken)
71-
.start();
68+
container = await new InfluxDBContainer(IMAGE).withAdminToken(adminToken).start();
7269

7370
// Write data using the InfluxDB 2.x API
7471
const writeUrl = `${container.getUrl()}/api/v2/write?org=${container.getOrganization()}&bucket=${container.getBucket()}`;
7572
const writeData = "temperature,location=room1 value=23.5";
76-
73+
7774
const writeResponse = await axios.post(writeUrl, writeData, {
7875
headers: {
7976
Authorization: `Token ${adminToken}`,
8077
"Content-Type": "text/plain",
8178
},
8279
});
83-
80+
8481
expect(writeResponse.status).toBe(204);
8582

8683
// Query data
@@ -104,7 +101,7 @@ describe("InfluxDBContainer", { timeout: 240_000 }, () => {
104101
container = await new InfluxDBContainer(IMAGE).start();
105102

106103
expect(container.isInfluxDB2()).toBe(true);
107-
104+
108105
const response = await axios.get(`${container.getUrl()}/ping`);
109106
expect(response.status).toBe(204);
110107
});
@@ -144,9 +141,7 @@ describe("InfluxDBContainer", { timeout: 240_000 }, () => {
144141
});
145142

146143
it("should respond to ping endpoint for v1", async () => {
147-
container = await new InfluxDBContainer("influxdb:1.8")
148-
.withAuthEnabled(false)
149-
.start();
144+
container = await new InfluxDBContainer("influxdb:1.8").withAuthEnabled(false).start();
150145

151146
const response = await axios.get(`${container.getUrl()}/ping`);
152147
expect(response.status).toBe(204);
@@ -167,21 +162,18 @@ describe("InfluxDBContainer", { timeout: 240_000 }, () => {
167162
});
168163

169164
it("should be able to write data with v1 API", async () => {
170-
container = await new InfluxDBContainer("influxdb:1.8")
171-
.withDatabase("testdb")
172-
.withAuthEnabled(false)
173-
.start();
165+
container = await new InfluxDBContainer("influxdb:1.8").withDatabase("testdb").withAuthEnabled(false).start();
174166

175167
// Write data using the InfluxDB 1.x API
176168
const writeUrl = `${container.getUrl()}/write?db=testdb`;
177169
const writeData = "cpu_usage,host=server01 value=0.64";
178-
170+
179171
const writeResponse = await axios.post(writeUrl, writeData, {
180172
headers: {
181173
"Content-Type": "text/plain",
182174
},
183175
});
184-
176+
185177
expect(writeResponse.status).toBe(204);
186178

187179
// Query data
@@ -207,4 +199,4 @@ describe("InfluxDBContainer", { timeout: 240_000 }, () => {
207199
await container.stop();
208200
});
209201
});
210-
});
202+
});

packages/modules/influxdb/src/influxdb-container.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ export class InfluxDBContainer extends GenericContainer {
1010
private retention?: string;
1111
private adminToken?: string;
1212
private readonly httpWait = Wait.forHttp("/ping", INFLUXDB_PORT).forStatusCode(204);
13-
13+
1414
// InfluxDB 1.x specific properties
1515
private authEnabled = true;
1616
private admin = "admin";
1717
private adminPassword = "password";
1818
private database?: string;
19-
19+
2020
private isVersion2: boolean = true;
2121

2222
constructor(image: string) {
@@ -148,14 +148,14 @@ export class InfluxDBContainer extends GenericContainer {
148148
if (tag === "latest") {
149149
return true; // Assume latest is v2
150150
}
151-
151+
152152
// Parse version number
153153
const versionMatch = tag.match(/^(\d+)(?:\.(\d+))?/);
154154
if (versionMatch) {
155155
const majorVersion = parseInt(versionMatch[1], 10);
156156
return majorVersion >= 2;
157157
}
158-
158+
159159
return true; // Default to v2 if unable to parse
160160
}
161161
}
@@ -222,11 +222,11 @@ export class StartedInfluxDBContainer extends AbstractStartedContainer {
222222
org: this.organization,
223223
bucket: this.bucket,
224224
});
225-
225+
226226
if (this.adminToken) {
227227
params.append("token", this.adminToken);
228228
}
229-
229+
230230
return `${this.getUrl()}?${params.toString()}`;
231231
} else {
232232
// InfluxDB 1.x connection string format

0 commit comments

Comments
 (0)