File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
src/test/java/org/testcontainers/containers Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,8 @@ dependencies {
66
77 testImplementation ' redis.clients:jedis:6.1.0'
88 testImplementation ' org.assertj:assertj-core:3.27.4'
9- testImplementation project(" :testcontainers-junit-jupiter" )
109 testImplementation platform(' org.junit:junit-bom:5.13.4' )
11- testImplementation ' org.junit.jupiter:junit-jupiter-api'
12- testImplementation ' org.junit.jupiter:junit-jupiter-params'
13- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine'
10+ testImplementation ' org.junit.jupiter:junit-jupiter'
1411 testRuntimeOnly ' org.junit.platform:junit-platform-launcher'
1512}
1613
Original file line number Diff line number Diff line change 33import eu .rekawek .toxiproxy .Proxy ;
44import eu .rekawek .toxiproxy .ToxiproxyClient ;
55import eu .rekawek .toxiproxy .model .ToxicDirection ;
6+ import org .junit .jupiter .api .AutoClose ;
7+ import org .junit .jupiter .api .BeforeEach ;
68import org .junit .jupiter .api .Test ;
7- import org .testcontainers .junit .jupiter .ManagedNetwork ;
89import redis .clients .jedis .Jedis ;
910import redis .clients .jedis .exceptions .JedisConnectionException ;
1011
@@ -22,23 +23,29 @@ public class ToxiproxyTest {
2223 // spotless:off
2324 // creatingProxy {
2425 // Create a common docker network so that containers can communicate
25- @ ManagedNetwork
26+ @ AutoClose
2627 public Network network = Network .newNetwork ();
2728
2829 // The target container - this could be anything
29- @ org . testcontainers . junit . jupiter . Container
30+ @ AutoClose
3031 public GenericContainer <?> redis = new GenericContainer <>("redis:6-alpine" )
3132 .withExposedPorts (6379 )
3233 .withNetwork (network )
3334 .withNetworkAliases ("redis" );
3435
3536 // Toxiproxy container, which will be used as a TCP proxy
36- @ org . testcontainers . junit . jupiter . Container
37+ @ AutoClose
3738 public ToxiproxyContainer toxiproxy = new ToxiproxyContainer ("ghcr.io/shopify/toxiproxy:2.5.0" )
3839 .withNetwork (network );
3940 // }
4041 // spotless:on
4142
43+ @ BeforeEach
44+ public void setUp () {
45+ redis .start ();
46+ toxiproxy .start ();
47+ }
48+
4249 @ Test
4350 public void testDirect () {
4451 final Jedis jedis = createJedis (redis .getHost (), redis .getFirstMappedPort ());
You can’t perform that action at this time.
0 commit comments