Skip to content

Commit d8de9ed

Browse files
author
Nont
committed
Allow testing multiple etcd releases
Signed-off-by: Nont <[email protected]>
1 parent 882713c commit d8de9ed

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

.github/workflows/antithesis-test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ on:
3434
required: true
3535
type: string
3636
default: "etcd nightly antithesis run"
37+
etcd_ref:
38+
description: 'etcd version to build etcd-server from'
39+
required: false
40+
type: string
41+
default: 'release-3.5'
3742
email:
3843
description: 'Additional email notification recipient (separate with ;)'
3944
required: true
@@ -85,7 +90,7 @@ jobs:
8590
- name: Build and push etcd image
8691
working-directory: ./tests/antithesis
8792
run: |
88-
make antithesis-build-etcd-image
93+
make antithesis-build-etcd-image-${{ inputs.etcd_ref }}
8994
export TAG="${{ env.REGISTRY }}/${{ env.REPOSITORY }}/etcd-server:latest"
9095
docker tag etcd-server:latest $TAG
9196
docker push $TAG

tests/antithesis/Makefile

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,44 @@ REPOSITORY_ROOT := $(shell git rev-parse --show-toplevel)
22
USER_ID := $(shell id -u)
33
GROUP_ID := $(shell id -g)
44
ARCH ?= $(shell go env GOARCH)
5+
REF = HEAD
6+
DOCKERFILE = ./Dockerfile
57

68
.PHONY: antithesis-build-client-docker-image
79
antithesis-build-client-docker-image:
810
docker build --build-arg GO_VERSION=$(shell cat $(REPOSITORY_ROOT)/.go-version) -f $(REPOSITORY_ROOT)/tests/antithesis/test-template/Dockerfile $(REPOSITORY_ROOT) -t etcd-client:latest
911

1012
.PHONY: antithesis-build-etcd-image
1113
antithesis-build-etcd-image:
12-
git fetch origin release-3.5
13-
git worktree remove -f /tmp/etcd3.5 || true
14-
git worktree add /tmp/etcd3.5 origin/release-3.5
15-
cd /tmp/etcd3.5 && make build
16-
cd /tmp/etcd3.5 && cp ./Dockerfile-release.$(ARCH) ./bin/Dockerfile
17-
cd /tmp/etcd3.5 && docker build \
14+
git worktree remove -f /tmp/etcd$(REF) || true
15+
git worktree add /tmp/etcd$(REF) $(REF)
16+
cd /tmp/etcd$(REF); make build
17+
cd /tmp/etcd$(REF); cp $(DOCKERFILE) ./bin/Dockerfile
18+
cd /tmp/etcd$(REF); docker build \
1819
--tag etcd-server:latest \
1920
./bin
20-
git worktree remove -f /tmp/etcd3.5
21+
git worktree remove -f /tmp/etcd$(REF)
22+
23+
.PHONY: antithesis-build-etcd-image-release-3.4
24+
antithesis-build-etcd-image-release-3.4: set-version-3.4 antithesis-build-etcd-image
25+
26+
.PHONY: antithesis-build-etcd-image-release-3.5
27+
antithesis-build-etcd-image-release-3.5: set-version-3.5 antithesis-build-etcd-image
28+
29+
.PHONY: antithesis-build-etcd-image-release-3.6
30+
antithesis-build-etcd-image-release-3.6: set-version-3.6 antithesis-build-etcd-image
2131

2232
.PHONY: antithesis-docker-compose-up
2333
antithesis-docker-compose-up:
24-
export USER_ID=$(USER_ID) && export GROUP_ID=$(GROUP_ID) && docker-compose up
34+
export USER_ID=$(USER_ID); export GROUP_ID=$(GROUP_ID); export VERSION=$(REF); docker-compose up
2535

2636
.PHONY: antithesis-run-container-traffic
2737
antithesis-run-container-traffic:
28-
export USER_ID=$(USER_ID) && export GROUP_ID=$(GROUP_ID) && docker-compose exec client /opt/antithesis/test/v1/robustness/singleton_driver_traffic
38+
export USER_ID=$(USER_ID); export GROUP_ID=$(GROUP_ID); docker-compose exec client /opt/antithesis/test/v1/robustness/singleton_driver_traffic
2939

3040
.PHONY: antithesis-run-container-validation
3141
antithesis-run-container-validation:
32-
export USER_ID=$(USER_ID) && export GROUP_ID=$(GROUP_ID) && docker-compose exec client /opt/antithesis/test/v1/robustness/finally_validation
42+
export USER_ID=$(USER_ID); export GROUP_ID=$(GROUP_ID); docker-compose exec client /opt/antithesis/test/v1/robustness/finally_validation
3343

3444
.PHONY: antithesis-run-local-traffic
3545
antithesis-run-local-traffic:
@@ -41,5 +51,20 @@ antithesis-run-local-validation:
4151

4252
.PHONY: antithesis-clean
4353
antithesis-clean:
44-
export USER_ID=$(USER_ID) && export GROUP_ID=$(GROUP_ID) && docker-compose down
54+
export USER_ID=$(USER_ID); export GROUP_ID=$(GROUP_ID); docker-compose down
4555
rm -rf /tmp/etcddata0 /tmp/etcddata1 /tmp/etcddata2 /tmp/etcdreport
56+
57+
.PHONY: set-version-3.4
58+
set-version-3.4:
59+
$(eval REF=release-3.4)
60+
$(eval DOCKERFILE=./Dockerfile-release)
61+
62+
.PHONY: set-version-3.5
63+
set-version-3.5:
64+
$(eval REF=releas-3.5)
65+
$(eval DOCKERFILE=./Dockerfile-release.amd64)
66+
67+
.PHONY: set-version-3.6
68+
set-version-3.6:
69+
$(eval REF=release-3.6)
70+
$(eval DOCKERFILE=./Dockerfile)

tests/antithesis/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ make antithesis-build-client-docker-image
1111
make antithesis-build-etcd-image
1212
```
1313

14+
Both commands build etcd-server and etcd-client from the current branch. To build a different version of etcd you can use:
15+
16+
```bash
17+
make antithesis-build-etcd-image REF=${YOUR_GIT_REF_OR_BRANCH} DOCKERFILE=${PATH_TO_etcd_DOCKERFILE}
18+
```
19+
20+
By default, REF is set to `HEAD` and DOCKERFILE is `./Dockerfile`. The etcd Dockerfile location might not be at the same location or have the same name (for example, compare its location `release-3.4` between `release-3.5`). If the file location or name is different than the default in the target ref or branch, change it accordingly.
21+
1422
### 2. (Optional) Check the Image Locally
1523

1624
You can verify your new image is built:
@@ -33,6 +41,8 @@ Run the following command from the root directory for Antithesis tests (`tests/a
3341
make antithesis-docker-compose-up
3442
```
3543

44+
The command uses the etcd client and server images built from step 1.
45+
3646
The client will continuously check the health of the etcd nodes and print logs similar to:
3747

3848
```

0 commit comments

Comments
 (0)