Skip to content

Commit

Permalink
etcd: update to v3.5.9
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Burgazzoli <lburgazzoli@gmail.com>
  • Loading branch information
lburgazzoli committed May 29, 2023
1 parent 7374906 commit 7ffebed
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: |
export TC_USER="$(id -u):$(id -g)"
echo "tc user -> $TC_USER"
./gradlew spotlessCheck
./gradlew test
./gradlew publishToSonatype -Prelease.forceSnapshot
3 changes: 3 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ jobs:
distribution: 'temurin'
- name: Build Project
run: |
export TC_USER="$(id -u):$(id -g)"
echo "tc user -> $TC_USER"
./gradlew check -x test
./gradlew test
3 changes: 2 additions & 1 deletion jetcd-core/src/test/java/io/etcd/jetcd/impl/WatchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
Expand Down Expand Up @@ -280,7 +281,7 @@ public void testWatchAndGet(final Client client) throws Exception {
if (event.getEventType() == EventType.PUT) {
ByteSequence key1 = event.getKeyValue().getKey();

client.getKVClient().get(key1).whenComplete((r, t) -> {
Future<?> unused = client.getKVClient().get(key1).whenComplete((r, t) -> {
if (!r.getKvs().isEmpty()) {
ref.set(r.getKvs().get(0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -52,7 +51,8 @@ public class WatchTokenExpireTest {
.withNodes(1)
.withSsl(true)
.withAdditionalArgs(
Arrays.asList("--auth-token",
List.of(
"--auth-token",
"jwt,pub-key=/etc/ssl/etcd/server.pem,priv-key=/etc/ssl/etcd/server-key.pem,sign-method=RS256,ttl=1s"))
.build();

Expand Down Expand Up @@ -87,7 +87,8 @@ private Client createAuthClient() throws Exception {
.user(user)
.password(password)
.authority("etcd0")
.sslContext(b -> b.trustManager(caFile)).build();
.sslContext(b -> b.trustManager(caFile))
.build();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.testcontainers.containers.Network;

public final class Etcd {
public static final String CONTAINER_IMAGE = "gcr.io/etcd-development/etcd:v3.5.4";
public static final String CONTAINER_IMAGE = "gcr.io/etcd-development/etcd:v3.5.9";
public static final int ETCD_CLIENT_PORT = 2379;
public static final int ETCD_PEER_PORT = 2380;
public static final String ETCD_DATA_DIR = "/data.etcd";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ protected void configure() {
withLogConsumer(new Slf4jLogConsumer(LOGGER).withPrefix(node));
withCommand(createCommand());

String user = System.getenv("TC_USER");
if (user != null) {
withCreateContainerCmdModifier(c -> c.withUser(user));
}

waitingFor(Wait.forLogMessage(".*ready to serve client requests.*", 1));
}

Expand Down Expand Up @@ -188,11 +193,15 @@ private String[] createCommand() {

private static void deleteDataDirectory(Path dir) {
if (dir != null && Files.exists(dir)) {
try (Stream<Path> stream = Files.walk(dir)) {
stream.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
} catch (IOException e) {
try {
try (Stream<Path> stream = Files.walk(dir)) {
stream.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
} catch (IOException e) {
LOGGER.error("Error deleting directory {}", dir, e);
}
} catch (Exception e) {
LOGGER.error("Error deleting directory {}", dir, e);
}
}
Expand Down

0 comments on commit 7ffebed

Please sign in to comment.