|
| 1 | +This directory enables integration of Antithesis with etcd. There are 4 containers running in this system: 3 that make up an etcd cluster (etcd0, etcd1, etcd2) and one that "[makes the system go](https://antithesis.com/docs/getting_started/basic_test_hookup/)" (client). |
| 2 | + |
| 3 | +## Quickstart |
| 4 | + |
| 5 | +### 1. Build and Tag the Docker Image |
| 6 | + |
| 7 | +Run this command from the `antithesis/test-template` directory: |
| 8 | + |
| 9 | +```bash |
| 10 | +docker build . -f Dockerfile.client -t etcd-client:latest |
| 11 | +``` |
| 12 | + |
| 13 | +### 2. (Optional) Check the Image Locally |
| 14 | + |
| 15 | +You can verify your new image is built: |
| 16 | + |
| 17 | +```bash |
| 18 | +docker images | grep etcd-client |
| 19 | +``` |
| 20 | + |
| 21 | +It should show something like: |
| 22 | + |
| 23 | +``` |
| 24 | +etcd-client latest <IMAGE_ID> <DATE> |
| 25 | +``` |
| 26 | + |
| 27 | +### 3. Use in Docker Compose |
| 28 | + |
| 29 | +Run the following command from the root directory for Antithesis tests (`tests/antithesis`): |
| 30 | + |
| 31 | +```bash |
| 32 | +docker-compose up |
| 33 | +``` |
| 34 | + |
| 35 | +The client will continuously check the health of the etcd nodes and print logs similar to: |
| 36 | + |
| 37 | +``` |
| 38 | +[+] Running 4/4 |
| 39 | + ✔ Container etcd0 Created 0.0s |
| 40 | + ✔ Container etcd2 Created 0.0s |
| 41 | + ✔ Container etcd1 Created 0.0s |
| 42 | + ✔ Container client Recreated 0.1s |
| 43 | +Attaching to client, etcd0, etcd1, etcd2 |
| 44 | +etcd2 | {"level":"info","ts":"2025-04-14T07:23:25.134294Z","caller":"flags/flag.go:113","msg":"recognized and used environment variable","variable-name":"ETCD_ADVERTISE_CLIENT_URLS","variable-value":"http://etcd2.etcd:2379"} |
| 45 | +etcd2 | {"level":"info","ts":"2025-04-14T07:23:25.138501Z","caller":"flags/flag.go:113","msg":"recognized and used environment variable","variable-name":"ETCD_INITIAL_ADVERTISE_PEER_URLS","variable-value":"http://etcd2:2380"} |
| 46 | +etcd2 | {"level":"info","ts":"2025-04-14T07:23:25.138646Z","caller":"flags/flag.go:113","msg":"recognized and used environment variable","variable-name":"ETCD_INITIAL_CLUSTER","variable-value":"etcd0=http://etcd0:2380,etcd1=http://etcd1:2380,etcd2=http://etcd2:2380"} |
| 47 | +etcd0 | {"level":"info","ts":"2025-04-14T07:23:25.138434Z","caller":"flags/flag.go:113","msg":"recognized and used environment variable","variable-name":"ETCD_ADVERTISE_CLIENT_URLS","variable-value":"http://etcd0.etcd:2379"} |
| 48 | +etcd0 | {"level":"info","ts":"2025-04-14T07:23:25.138582Z","caller":"flags/flag.go:113","msg":"recognized and used environment variable","variable-name":"ETCD_INITIAL_ADVERTISE_PEER_URLS","variable-value":"http://etcd0:2380"} |
| 49 | +etcd0 | {"level":"info","ts":"2025-04-14T07:23:25.138592Z","caller":"flags/flag.go:113","msg":"recognized and used environment variable","variable-name":"ETCD_INITIAL_CLUSTER","variable-value":"etcd0=http://etcd0:2380,etcd1=http://etcd1:2380,etcd2=http://etcd2:2380"} |
| 50 | +
|
| 51 | +... |
| 52 | +... |
| 53 | +(skipping some repeated logs for brevity) |
| 54 | +... |
| 55 | +... |
| 56 | +
|
| 57 | +etcd2 | {"level":"info","ts":"2025-04-14T07:23:25.484698Z","caller":"etcdmain/main.go:50","msg":"successfully notified init daemon"} |
| 58 | +etcd1 | {"level":"info","ts":"2025-04-14T07:23:25.484092Z","caller":"embed/serve.go:210","msg":"serving client traffic insecurely; this is strongly discouraged!","traffic":"grpc+http","address":"[::]:2379"} |
| 59 | +etcd0 | {"level":"info","ts":"2025-04-14T07:23:25.484563Z","caller":"etcdmain/main.go:50","msg":"successfully notified init daemon"} |
| 60 | +etcd2 | {"level":"info","ts":"2025-04-14T07:23:25.485101Z","caller":"v3rpc/health.go:61","msg":"grpc service status changed","service":"","status":"SERVING"} |
| 61 | +etcd1 | {"level":"info","ts":"2025-04-14T07:23:25.484130Z","caller":"etcdmain/main.go:44","msg":"notifying init daemon"} |
| 62 | +etcd2 | {"level":"info","ts":"2025-04-14T07:23:25.485782Z","caller":"embed/serve.go:210","msg":"serving client traffic insecurely; this is strongly discouraged!","traffic":"grpc+http","address":"[::]:2379"} |
| 63 | +etcd1 | {"level":"info","ts":"2025-04-14T07:23:25.484198Z","caller":"etcdmain/main.go:50","msg":"successfully notified init daemon"} |
| 64 | +client | Client [entrypoint]: starting... |
| 65 | +client | Client [entrypoint]: checking cluster health... |
| 66 | +client | Client [entrypoint]: connection successful with etcd0 |
| 67 | +client | Client [entrypoint]: connection successful with etcd1 |
| 68 | +client | Client [entrypoint]: connection successful with etcd2 |
| 69 | +client | Client [entrypoint]: cluster is healthy! |
| 70 | +``` |
| 71 | + |
| 72 | +And it will stay running indefinitely. |
| 73 | + |
| 74 | +## Troubleshooting |
| 75 | + |
| 76 | +- **Image Pull Errors**: If Docker can’t pull `etcd-client:latest`, make sure you built it locally (see the “Build and Tag” step) or push it to a registry that Compose can access. |
0 commit comments