You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/toxiproxy.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,21 @@ We do this as follows:
29
29
[Starting proxying connections to a target container](../../modules/toxiproxy/src/test/java/org/testcontainers/containers/ToxiproxyTest.java) inside_block:obtainProxyObject
30
30
<!--/codeinclude-->
31
31
32
-
Then, to establish a connection via Toxiproxy, we obtain **Toxiproxy's** proxy host IP and port:
32
+
To establish a connection from the test code (on the host machine) to the target container via Toxiproxy, we obtain **Toxiproxy's** proxy host IP and port:
33
33
34
34
<!--codeinclude-->
35
-
[Obtaining proxied host and port](../../modules/toxiproxy/src/test/java/org/testcontainers/containers/ToxiproxyTest.java) inside_block:obtainProxiedHostAndPort
35
+
[Obtaining proxied host and port for connections from the host machine](../../modules/toxiproxy/src/test/java/org/testcontainers/containers/ToxiproxyTest.java) inside_block:obtainProxiedHostAndPortForHostMachine
36
36
<!--/codeinclude-->
37
37
38
-
Code under test, or other containers, should connect to this proxied host IP and port.
38
+
Code under test should connect to this proxied host IP and port.
39
+
40
+
To establish a connection from a different container on the same network to the target container via Toxiproxy, we use **Toxiproxy's** network alias and original port:
41
+
42
+
<!--codeinclude-->
43
+
[Obtaining proxied host and port for connections from a different container](../../modules/toxiproxy/src/test/java/org/testcontainers/containers/ToxiproxyTest.java) inside_block:obtainProxiedHostAndPortForDifferentContainer
44
+
<!--/codeinclude-->
45
+
46
+
Other containers should connect to this proxied host and port.
39
47
40
48
Having done this, it is possible to trigger failure conditions ('Toxics') through the `proxy.toxics()` object:
This module was inspired by a [hotels.com blog post](https://medium.com/hotels-com-technology/i-dont-know-about-resilience-testing-and-so-can-you-b3c59d80012d).
83
91
84
92
[toxiproxy-java](https://github.com/trekawek/toxiproxy-java) is used to help control failure conditions.
0 commit comments