Skip to content

Commit 7e5f9af

Browse files
committed
test: client works with and without slash at the and of url (influxdata/influxdb-client-python#87)
1 parent 3c20601 commit 7e5f9af

9 files changed

+36
-19
lines changed

client/src/test/java/com/influxdb/client/ITChecksApi.java

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
import org.assertj.core.api.Assertions;
4848
import org.junit.jupiter.api.BeforeEach;
49-
import org.junit.jupiter.api.Disabled;
5049
import org.junit.jupiter.api.Test;
5150
import org.junit.platform.runner.JUnitPlatform;
5251
import org.junit.runner.RunWith;
@@ -342,8 +341,6 @@ void labelAddNotExists() {
342341
}
343342

344343
@Test
345-
//TODO wait to v2.0.0-beta.7
346-
@Disabled
347344
void labelDeleteNotExists() {
348345

349346
GreaterThreshold greater = new GreaterThreshold();

client/src/test/java/com/influxdb/client/ITDashboardsApi.java

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
import org.assertj.core.api.Assertions;
4848
import org.junit.jupiter.api.BeforeEach;
49-
import org.junit.jupiter.api.Disabled;
5049
import org.junit.jupiter.api.Test;
5150
import org.junit.platform.runner.JUnitPlatform;
5251
import org.junit.runner.RunWith;
@@ -276,8 +275,6 @@ void labelAddNotExists() {
276275
.isInstanceOf(NotFoundException.class);
277276
}
278277

279-
//TODO wait to v2.0.0-beta.7
280-
@Disabled
281278
@Test
282279
void labelDeleteNotExists() {
283280

client/src/test/java/com/influxdb/client/ITNotificationEndpointsApi.java

-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
import org.assertj.core.api.Assertions;
4444
import org.junit.jupiter.api.BeforeEach;
45-
import org.junit.jupiter.api.Disabled;
4645
import org.junit.jupiter.api.Test;
4746
import org.junit.platform.runner.JUnitPlatform;
4847
import org.junit.runner.RunWith;
@@ -585,8 +584,6 @@ void labelAddNotExists() {
585584
.isInstanceOf(NotFoundException.class);
586585
}
587586

588-
//TODO wait to v2.0.0-beta.7
589-
@Disabled
590587
@Test
591588
void labelDeleteNotExists() {
592589

client/src/test/java/com/influxdb/client/ITNotificationRulesApi.java

-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252

5353
import org.assertj.core.api.Assertions;
5454
import org.junit.jupiter.api.BeforeEach;
55-
import org.junit.jupiter.api.Disabled;
5655
import org.junit.jupiter.api.Test;
5756
import org.junit.platform.runner.JUnitPlatform;
5857
import org.junit.runner.RunWith;
@@ -450,8 +449,6 @@ void labelAddNotExists() {
450449
.isInstanceOf(NotFoundException.class);
451450
}
452451

453-
//TODO wait to v2.0.0-beta.7
454-
@Disabled
455452
@Test
456453
void labelDeleteNotExists() {
457454

client/src/test/java/com/influxdb/client/ITOrganizationsApi.java

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
import org.assertj.core.api.Assertions;
4545
import org.junit.jupiter.api.BeforeEach;
46+
import org.junit.jupiter.api.Disabled;
4647
import org.junit.jupiter.api.Test;
4748
import org.junit.platform.runner.JUnitPlatform;
4849
import org.junit.runner.RunWith;
@@ -293,6 +294,8 @@ void labels() {
293294
Assertions.assertThat(labels).hasSize(0);
294295
}
295296

297+
//TODO https://github.com/influxdata/influxdb/issues/18048
298+
@Disabled
296299
@Test
297300
void findOrganizationLogs() {
298301

@@ -309,6 +312,8 @@ void findOrganizationLogsNotFound() {
309312
Assertions.assertThat(userLogs).isEmpty();
310313
}
311314

315+
//TODO https://github.com/influxdata/influxdb/issues/18048
316+
@Disabled
312317
@Test
313318
void findOrganizationLogsPaging() {
314319

client/src/test/java/com/influxdb/client/ITTelegrafsApi.java

-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import com.moandjiezana.toml.Toml;
4141
import org.assertj.core.api.Assertions;
4242
import org.junit.jupiter.api.BeforeEach;
43-
import org.junit.jupiter.api.Disabled;
4443
import org.junit.jupiter.api.Test;
4544
import org.junit.platform.runner.JUnitPlatform;
4645
import org.junit.runner.RunWith;
@@ -369,8 +368,6 @@ void labelAddNotExists() {
369368
.isInstanceOf(NotFoundException.class);
370369
}
371370

372-
//TODO wait to v2.0.0-beta.7
373-
@Disabled
374371
@Test
375372
void labelDeleteNotExists() {
376373

client/src/test/java/com/influxdb/client/ITUsersApi.java

+4
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ void updatePasswordById() {
220220
usersApi.updateUserPassword(user.getId(), "my-password", "my-password");
221221
}
222222

223+
//TODO https://github.com/influxdata/influxdb/issues/18048
224+
@Disabled
223225
@Test
224226
void findUserLogs() {
225227

@@ -243,6 +245,8 @@ void findUserLogsNotFound() {
243245
Assertions.assertThat(userLogs).isEmpty();
244246
}
245247

248+
//TODO https://github.com/influxdata/influxdb/issues/18048
249+
@Disabled
246250
@Test
247251
void findUserLogsPaging() {
248252

client/src/test/java/com/influxdb/client/ITVariablesApi.java

-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
import org.assertj.core.api.Assertions;
4040
import org.junit.jupiter.api.BeforeEach;
41-
import org.junit.jupiter.api.Disabled;
4241
import org.junit.jupiter.api.Test;
4342
import org.junit.platform.runner.JUnitPlatform;
4443
import org.junit.runner.RunWith;
@@ -328,8 +327,6 @@ void labelAddNotExists() {
328327
.isInstanceOf(NotFoundException.class);
329328
}
330329

331-
//TODO wait to v2.0.0-beta.7
332-
@Disabled
333330
@Test
334331
void labelDeleteNotExists() {
335332

client/src/test/java/com/influxdb/client/InfluxDBClientTest.java

+27-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.influxdb.LogLevel;
2525
import com.influxdb.client.domain.Authorization;
2626
import com.influxdb.client.domain.OperationLogs;
27+
import com.influxdb.client.domain.WritePrecision;
2728
import com.influxdb.client.internal.AbstractInfluxDBClientTest;
2829

2930
import okhttp3.mockwebserver.MockResponse;
@@ -183,8 +184,33 @@ void parseDateTime() {
183184

184185
@Test
185186
public void autoClosable() {
186-
try (InfluxDBClient client = InfluxDBClientFactory.create(mockServer.url("/").url().toString())){
187+
try (InfluxDBClient client = InfluxDBClientFactory.create(mockServer.url("/").url().toString())) {
187188
Assertions.assertThat(client).isNotNull();
188189
}
189190
}
191+
192+
@Test
193+
public void testTrailingSlashInUrl() throws InterruptedException {
194+
mockServer.enqueue(new MockResponse());
195+
mockServer.enqueue(new MockResponse());
196+
197+
String path = mockServer.url("/").toString();
198+
InfluxDBClient influxDBClient = InfluxDBClientFactory
199+
.create(path, "my-token".toCharArray());
200+
201+
influxDBClient.getWriteApiBlocking().writeRecord("my-bucket", "my-org", WritePrecision.NS, "record,tag=a value=1");
202+
203+
RecordedRequest request = mockServer.takeRequest();
204+
Assertions.assertThat(request.getRequestUrl().toString()).isEqualTo(path + "api/v2/write?org=my-org&bucket=my-bucket&precision=ns");
205+
influxDBClient.close();
206+
207+
influxDBClient = InfluxDBClientFactory
208+
.create(path.substring(0, path.length() - 1), "my-token".toCharArray());
209+
210+
influxDBClient.getWriteApiBlocking().writeRecord("my-bucket", "my-org", WritePrecision.NS, "record,tag=a value=1");
211+
212+
request = mockServer.takeRequest();
213+
Assertions.assertThat(request.getRequestUrl().toString()).isEqualTo(path + "api/v2/write?org=my-org&bucket=my-bucket&precision=ns");
214+
influxDBClient.close();
215+
}
190216
}

0 commit comments

Comments
 (0)