Skip to content

Commit

Permalink
bump lettuce version used in test module to allow access to protocol …
Browse files Browse the repository at this point in the history
…control
  • Loading branch information
jaydeluca committed Oct 18, 2023
1 parent a6466c1 commit 5f06bdc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
3 changes: 2 additions & 1 deletion instrumentation/lettuce/lettuce-5.1/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ plugins {
dependencies {
api(project(":testing-common"))

api("io.lettuce:lettuce-core:5.1.0.RELEASE")
// 6.0+ is needed to force RESP2 for consistency in tests (see LettuceTestClientUtil)
compileOnly("io.lettuce:lettuce-core:6.0.0.RELEASE")

implementation("org.testcontainers:testcontainers")
implementation("com.google.guava:guava")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ protected ContainerConnection newContainerConnection() {
StatefulRedisConnection<String, String> statefulConnection = client.connect();
cleanup.deferCleanup(statefulConnection);

if (Boolean.getBoolean("testLatestDeps")) {
// 1 HELLO (in lettuce 6+)
getInstrumentationExtension().waitForTraces(1);
}
getInstrumentationExtension().clearData();
return new ContainerConnection(statefulConnection, serverPort);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ void setUp() {
syncCommands.set("TESTKEY", "TESTVAL");
syncCommands.hmset("TESTHM", testHashMap);

if (Boolean.getBoolean("testLatestDeps")) {
// 1 HELLO (in lettuce 6+) and 2 sets
getInstrumentationExtension().waitForTraces(3);
} else {
// 2 sets
getInstrumentationExtension().waitForTraces(2);
}
getInstrumentationExtension().waitForTraces(2);
getInstrumentationExtension().clearData();
}

Expand Down Expand Up @@ -138,12 +132,6 @@ void testSetCommandLocalhost() {
StatefulRedisConnection<String, String> testConnection = testConnectionClient.connect();
cleanup.deferCleanup(testConnection);

if (Boolean.getBoolean("testLatestDeps")) {
// 1 HELLO (in lettuce 6+)
getInstrumentationExtension().waitForTraces(1);
getInstrumentationExtension().clearData();
}

String res = testConnection.sync().set("TESTSETKEY", "TESTSETVAL");
assertThat(res).isEqualTo("OK");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package io.opentelemetry.instrumentation.lettuce.v5_1;

import io.lettuce.core.ClientOptions;
import io.lettuce.core.protocol.ProtocolVersion;

final class LettuceTestClientUtil {
static final ClientOptions CLIENT_OPTIONS;
Expand All @@ -17,7 +18,7 @@ final class LettuceTestClientUtil {
.autoReconnect(false);
if (Boolean.getBoolean("testLatestDeps")) {
// Force RESP2 on 6+ for consistency in tests
options.pingBeforeActivateConnection(false);
options.pingBeforeActivateConnection(false).protocolVersion(ProtocolVersion.RESP2);
}
CLIENT_OPTIONS = options.build();
}
Expand Down

0 comments on commit 5f06bdc

Please sign in to comment.