Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-krecan committed Jan 29, 2022
1 parent c379abd commit 5bf66d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
include:
- java: '8'
maven-opts: ''
maven-params: -pl '!spring/test/shedlock-springboot-future-test'
maven-params: -pl '!spring/test/shedlock-springboot-future-test,!providers/etcd/shedlock-provider-etcd-jetcd'
- java: '11'
maven-opts: ''
maven-params: -pl '!spring/test/shedlock-springboot-future-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import io.etcd.jetcd.ByteSequence;
import io.etcd.jetcd.Client;
import io.etcd.jetcd.KV;
import io.etcd.jetcd.test.EtcdClusterExtension;
import io.etcd.jetcd.launcher.Etcd;
import io.etcd.jetcd.launcher.EtcdCluster;
import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.test.support.AbstractLockProviderIntegrationTest;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import static java.time.Duration.ofSeconds;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
Expand All @@ -33,14 +35,21 @@

public class EtcdLockProviderIntegrationTest extends AbstractLockProviderIntegrationTest {

@RegisterExtension
static final EtcdClusterExtension etcdCluster = new EtcdClusterExtension.Builder()
.withNodes(1)
.build();
private static final EtcdCluster cluster = new Etcd.Builder().withNodes(1).build();

private EtcdLockProvider lockProvider;
private KV kvClient;

@BeforeAll
static void startCluster() {
cluster.start();
}

@AfterAll
static void stopCluster() {
cluster.stop();
}

@BeforeEach
public void createLockProvider() {
Client client = buildClient();
Expand Down Expand Up @@ -110,7 +119,7 @@ protected LockProvider getLockProvider() {
}

private Client buildClient() {
return Client.builder().endpoints(etcdCluster.clientEndpoints()).build();
return Client.builder().endpoints(cluster.clientEndpoints()).build();
}

}

0 comments on commit 5bf66d4

Please sign in to comment.