Skip to content

Commit 99cf6c4

Browse files
otelbot[bot]trask
andauthored
Module cleanup (run 25334255221) (open-telemetry#18569)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
1 parent f2fb85e commit 99cf6c4

11 files changed

Lines changed: 31 additions & 34 deletions

File tree

instrumentation/kubernetes-client-7.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/v7_0/KubernetesClientTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS;
1717
import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT;
1818
import static io.opentelemetry.semconv.UrlAttributes.URL_FULL;
19+
import static java.util.concurrent.TimeUnit.SECONDS;
1920
import static org.assertj.core.api.Assertions.assertThat;
2021

2122
import io.kubernetes.client.openapi.ApiCallback;
@@ -187,7 +188,7 @@ public void onSuccess(
187188
}
188189
}));
189190

190-
countDownLatch.await();
191+
assertThat(countDownLatch.await(10, SECONDS)).isTrue();
191192

192193
assertThat(responseBodyReference.get()).isEqualTo("42");
193194
assertThat(mockWebServer.takeRequest().request().headers().get("traceparent")).isNotBlank();
@@ -247,7 +248,7 @@ public void onFailure(
247248
}
248249
}));
249250

250-
countDownLatch.await();
251+
assertThat(countDownLatch.await(10, SECONDS)).isTrue();
251252

252253
assertThat(exceptionReference.get()).isNotNull();
253254
assertThat(mockWebServer.takeRequest().request().headers().get("traceparent")).isNotBlank();

instrumentation/kubernetes-client-7.0/javaagent/src/version20Test/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/v7_0/KubernetesClientVer20Test.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS;
1717
import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT;
1818
import static io.opentelemetry.semconv.UrlAttributes.URL_FULL;
19+
import static java.util.concurrent.TimeUnit.SECONDS;
1920
import static org.assertj.core.api.Assertions.assertThat;
2021

2122
import io.kubernetes.client.openapi.ApiCallback;
@@ -196,7 +197,7 @@ public void onSuccess(
196197
}
197198
}));
198199

199-
countDownLatch.await();
200+
assertThat(countDownLatch.await(10, SECONDS)).isTrue();
200201

201202
assertThat(responseBodyReference.get()).isEqualTo("42");
202203
assertThat(mockWebServer.takeRequest().request().headers().get("traceparent")).isNotBlank();
@@ -257,7 +258,7 @@ public void onFailure(
257258
}
258259
}));
259260

260-
countDownLatch.await();
261+
assertThat(countDownLatch.await(10, SECONDS)).isTrue();
261262

262263
assertThat(exceptionReference.get()).isNotNull();
263264
assertThat(mockWebServer.takeRequest().request().headers().get("traceparent")).isNotBlank();

instrumentation/lettuce/lettuce-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceDbAttributesGetter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public String getDbQueryText(RedisCommand<?, ?, ?> request) {
3131
}
3232

3333
@Override
34-
@Nullable
3534
public String getDbOperationName(RedisCommand<?, ?, ?> request) {
3635
return request.getType().name();
3736
}

instrumentation/lettuce/lettuce-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/ExperimentalHelper.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55

66
package io.opentelemetry.javaagent.instrumentation.lettuce.v4_0;
77

8-
import javax.annotation.Nullable;
9-
108
class ExperimentalHelper {
119

1210
private static final boolean EXPERIMENTAL_ATTRIBUTES_ENABLED =
1311
Boolean.getBoolean("otel.instrumentation.lettuce.experimental-span-attributes");
1412

15-
@Nullable
1613
static <T> T experimental(T value) {
1714
return EXPERIMENTAL_ATTRIBUTES_ENABLED ? value : null;
1815
}

instrumentation/lettuce/lettuce-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceAsyncClientTest.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class LettuceAsyncClientTest {
7171

7272
@RegisterExtension static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
7373

74-
static final DockerImageName containerImage = DockerImageName.parse("redis:6.2.3-alpine");
74+
private static final DockerImageName CONTAINER_IMAGE =
75+
DockerImageName.parse("redis:6.2.3-alpine");
7576

7677
private static final int DB_INDEX = 0;
7778

@@ -80,7 +81,7 @@ class LettuceAsyncClientTest {
8081
new ClientOptions.Builder().autoReconnect(false).build();
8182

8283
private static final GenericContainer<?> redisServer =
83-
new GenericContainer<>(containerImage)
84+
new GenericContainer<>(CONTAINER_IMAGE)
8485
.withExposedPorts(6379)
8586
.withLogConsumer(new Slf4jLogConsumer(logger))
8687
.waitingFor(Wait.forLogMessage(".*Ready to accept connections.*", 1));
@@ -91,15 +92,15 @@ class LettuceAsyncClientTest {
9192
private static String dbUriNonExistent;
9293
private static String embeddedDbUri;
9394

94-
private static final ImmutableMap<String, String> testHashMap =
95+
private static final ImmutableMap<String, String> TEST_HASH_MAP =
9596
ImmutableMap.of(
9697
"firstname", "John",
9798
"lastname", "Doe",
9899
"age", "53");
99100

100-
static RedisClient redisClient;
101+
private static RedisClient redisClient;
101102
private static StatefulRedisConnection<String, String> connection;
102-
static RedisAsyncCommands<String, String> asyncCommands;
103+
private static RedisAsyncCommands<String, String> asyncCommands;
103104

104105
@BeforeAll
105106
static void setUp() {
@@ -341,7 +342,7 @@ void testCommandWithNoArgumentsUsingBiconsumer() {
341342
void testHashSetAndThenNestApplyToHashGetall() {
342343
CompletableFuture<Map<String, String>> future = new CompletableFuture<>();
343344

344-
RedisFuture<String> hmsetFuture = asyncCommands.hmset("TESTHM", testHashMap);
345+
RedisFuture<String> hmsetFuture = asyncCommands.hmset("TESTHM", TEST_HASH_MAP);
345346
hmsetFuture.thenApplyAsync(
346347
setResult -> {
347348
// Wait for 'hmset' trace to get written
@@ -364,7 +365,7 @@ void testHashSetAndThenNestApplyToHashGetall() {
364365
return null;
365366
});
366367

367-
await().untilAsserted(() -> assertThat(future).isCompletedWithValue(testHashMap));
368+
await().untilAsserted(() -> assertThat(future).isCompletedWithValue(TEST_HASH_MAP));
368369

369370
testing.waitAndAssertTraces(
370371
trace ->
@@ -478,7 +479,7 @@ void testCommandBeforeItFinished() {
478479
@Test
479480
void testDebugSegfaultCommandWithNoArgumentShouldProduceSpan() {
480481
// Test Causes redis to crash therefore it needs its own container
481-
GenericContainer<?> server = new GenericContainer<>(containerImage).withExposedPorts(6379);
482+
GenericContainer<?> server = new GenericContainer<>(CONTAINER_IMAGE).withExposedPorts(6379);
482483
server.start();
483484
cleanup.deferCleanup(server::stop);
484485

@@ -510,7 +511,7 @@ void testDebugSegfaultCommandWithNoArgumentShouldProduceSpan() {
510511
@Test
511512
void testShutdownCommandShouldProduceSpan() {
512513
// Test Causes redis to crash therefore it needs its own container
513-
GenericContainer<?> server = new GenericContainer<>(containerImage).withExposedPorts(6379);
514+
GenericContainer<?> server = new GenericContainer<>(CONTAINER_IMAGE).withExposedPorts(6379);
514515
server.start();
515516
cleanup.deferCleanup(server::stop);
516517

instrumentation/lettuce/lettuce-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceSyncClientTest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ class LettuceSyncClientTest {
5050

5151
@RegisterExtension static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
5252

53-
static final DockerImageName containerImage = DockerImageName.parse("redis:6.2.3-alpine");
53+
private static final DockerImageName CONTAINER_IMAGE =
54+
DockerImageName.parse("redis:6.2.3-alpine");
5455

5556
private static final int DB_INDEX = 0;
5657

@@ -59,7 +60,7 @@ class LettuceSyncClientTest {
5960
new ClientOptions.Builder().autoReconnect(false).build();
6061

6162
private static final GenericContainer<?> redisServer =
62-
new GenericContainer<>(containerImage)
63+
new GenericContainer<>(CONTAINER_IMAGE)
6364
.withExposedPorts(6379)
6465
.withLogConsumer(new Slf4jLogConsumer(logger))
6566
.waitingFor(Wait.forLogMessage(".*Ready to accept connections.*", 1));
@@ -70,16 +71,16 @@ class LettuceSyncClientTest {
7071
private static String dbUriNonExistent;
7172
private static String embeddedDbUri;
7273

73-
private static final ImmutableMap<String, String> testHashMap =
74+
private static final ImmutableMap<String, String> TEST_HASH_MAP =
7475
ImmutableMap.of(
7576
"firstname", "John",
7677
"lastname", "Doe",
7778
"age", "53");
7879

79-
static RedisClient redisClient;
80+
private static RedisClient redisClient;
8081

8182
private static StatefulRedisConnection<String, String> connection;
82-
static RedisCommands<String, String> syncCommands;
83+
private static RedisCommands<String, String> syncCommands;
8384

8485
@BeforeAll
8586
static void setUp() {
@@ -101,7 +102,7 @@ static void setUp() {
101102
syncCommands = connection.sync();
102103

103104
syncCommands.set("TESTKEY", "TESTVAL");
104-
syncCommands.hmset("TESTHM", testHashMap);
105+
syncCommands.hmset("TESTHM", TEST_HASH_MAP);
105106

106107
// 2 sets + 1 connect trace
107108
testing.waitForTraces(3);
@@ -239,7 +240,7 @@ void testListCommand() {
239240

240241
@Test
241242
void testHashSetCommand() {
242-
String res = syncCommands.hmset("user", testHashMap);
243+
String res = syncCommands.hmset("user", TEST_HASH_MAP);
243244
assertThat(res).isEqualTo("OK");
244245

245246
testing.waitAndAssertTraces(
@@ -256,7 +257,7 @@ void testHashSetCommand() {
256257
@Test
257258
void testHashGetallCommand() {
258259
Map<String, String> res = syncCommands.hgetall("TESTHM");
259-
assertThat(res).isEqualTo(testHashMap);
260+
assertThat(res).isEqualTo(TEST_HASH_MAP);
260261

261262
testing.waitAndAssertTraces(
262263
trace ->
@@ -272,7 +273,7 @@ void testHashGetallCommand() {
272273
@Test
273274
void testDebugSegfaultCommandWithNoArgumentShouldProduceSpan() {
274275
// Test Causes redis to crash therefore it needs its own container
275-
GenericContainer<?> server = new GenericContainer<>(containerImage).withExposedPorts(6379);
276+
GenericContainer<?> server = new GenericContainer<>(CONTAINER_IMAGE).withExposedPorts(6379);
276277
server.start();
277278
cleanup.deferCleanup(server::stop);
278279

@@ -304,7 +305,7 @@ void testDebugSegfaultCommandWithNoArgumentShouldProduceSpan() {
304305
@Test
305306
void testShutdownCommandShouldProduceSpan() {
306307
// Test Causes redis to crash therefore it needs its own container
307-
GenericContainer<?> server = new GenericContainer<>(containerImage).withExposedPorts(6379);
308+
GenericContainer<?> server = new GenericContainer<>(CONTAINER_IMAGE).withExposedPorts(6379);
308309
server.start();
309310
cleanup.deferCleanup(server::stop);
310311

instrumentation/lettuce/lettuce-5.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/lettuce/v5_0/ExperimentalHelper.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@
55

66
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
77

8-
import javax.annotation.Nullable;
9-
108
class ExperimentalHelper {
119

1210
static final boolean EXPERIMENTAL_ATTRIBUTES_ENABLED =
1311
Boolean.getBoolean("otel.instrumentation.lettuce.experimental-span-attributes");
1412

15-
@Nullable
1613
static <T> T experimental(T value) {
1714
return EXPERIMENTAL_ATTRIBUTES_ENABLED ? value : null;
1815
}

instrumentation/lettuce/lettuce-5.1/library/src/test/java/io/opentelemetry/instrumentation/lettuce/v5_1/LettuceAsyncClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class LettuceAsyncClientTest extends AbstractLettuceAsyncClientTest {
1616
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();
1717

1818
@Override
19-
public InstrumentationExtension testing() {
19+
protected InstrumentationExtension testing() {
2020
return testing;
2121
}
2222

instrumentation/lettuce/lettuce-5.1/library/src/test/java/io/opentelemetry/instrumentation/lettuce/v5_1/LettuceReactiveClientTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest {
2222
ContextPropagationOperator.create();
2323

2424
@Override
25-
public InstrumentationExtension testing() {
25+
protected InstrumentationExtension testing() {
2626
return testing;
2727
}
2828

instrumentation/lettuce/lettuce-5.1/library/src/test/java/io/opentelemetry/instrumentation/lettuce/v5_1/LettuceSyncClientAuthTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class LettuceSyncClientAuthTest extends AbstractLettuceSyncClientAuthTest {
1616
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();
1717

1818
@Override
19-
public InstrumentationExtension testing() {
19+
protected InstrumentationExtension testing() {
2020
return testing;
2121
}
2222

0 commit comments

Comments
 (0)