Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/toxiproxy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ dependencies {

testImplementation 'redis.clients:jedis:6.1.0'
testImplementation 'org.assertj:assertj-core:3.27.4'
testImplementation platform('org.junit:junit-bom:5.13.4')
testImplementation 'org.junit.jupiter:junit-jupiter'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.japicmp {
classExcludes = [
"org.testcontainers.containers.ToxiproxyContainer"
]
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import eu.rekawek.toxiproxy.Proxy;
import eu.rekawek.toxiproxy.ToxiproxyClient;
import eu.rekawek.toxiproxy.model.ToxicDirection;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.AutoClose;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.exceptions.JedisConnectionException;

Expand All @@ -22,23 +23,29 @@ public class ToxiproxyTest {
// spotless:off
// creatingProxy {
// Create a common docker network so that containers can communicate
@Rule
@AutoClose
public Network network = Network.newNetwork();

// The target container - this could be anything
@Rule
@AutoClose
public GenericContainer<?> redis = new GenericContainer<>("redis:6-alpine")
.withExposedPorts(6379)
.withNetwork(network)
.withNetworkAliases("redis");

// Toxiproxy container, which will be used as a TCP proxy
@Rule
@AutoClose
public ToxiproxyContainer toxiproxy = new ToxiproxyContainer("ghcr.io/shopify/toxiproxy:2.5.0")
.withNetwork(network);
// }
// spotless:on

@BeforeEach
public void setUp() {
redis.start();
toxiproxy.start();
}

@Test
public void testDirect() {
final Jedis jedis = createJedis(redis.getHost(), redis.getFirstMappedPort());
Expand Down
Loading