Skip to content

Commit a7fca26

Browse files
committed
Add e2e testing for signing and resharing
1 parent 3a9bb76 commit a7fca26

11 files changed

Lines changed: 1049 additions & 148 deletions

.github/workflows/e2e-tests.yml

Lines changed: 245 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,63 @@ on:
77
branches: [e2e]
88

99
jobs:
10-
e2e-tests:
10+
# Build job that creates the binaries needed by all E2E test jobs
11+
build:
1112
runs-on: ubuntu-latest
13+
outputs:
14+
cache-key: ${{ steps.cache-key.outputs.key }}
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v4
22+
with:
23+
go-version: "1.23"
24+
25+
- name: Generate cache key
26+
id: cache-key
27+
run: echo "key=${{ runner.os }}-binaries-${{ hashFiles('**/go.sum', '**/*.go') }}" >> $GITHUB_OUTPUT
28+
29+
- name: Cache binaries
30+
id: cache-binaries
31+
uses: actions/cache@v3
32+
with:
33+
path: |
34+
./mpcium
35+
./mpcium-cli
36+
key: ${{ steps.cache-key.outputs.key }}
37+
38+
- name: Cache Go modules
39+
if: steps.cache-binaries.outputs.cache-hit != 'true'
40+
uses: actions/cache@v3
41+
with:
42+
path: |
43+
~/.cache/go-build
44+
~/go/pkg/mod
45+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
46+
restore-keys: |
47+
${{ runner.os }}-go-
48+
49+
- name: Install dependencies
50+
if: steps.cache-binaries.outputs.cache-hit != 'true'
51+
run: |
52+
go mod download
53+
cd e2e && go mod download
54+
55+
- name: Build binaries
56+
if: steps.cache-binaries.outputs.cache-hit != 'true'
57+
run: |
58+
go build -o mpcium ./cmd/mpcium
59+
go build -o mpcium-cli ./cmd/mpcium-cli
60+
chmod +x mpcium mpcium-cli
1261
62+
# Key Generation E2E Tests
63+
e2e-keygen:
64+
runs-on: ubuntu-latest
65+
needs: build
66+
1367
steps:
1468
- name: Checkout code
1569
uses: actions/checkout@v4
@@ -37,22 +91,94 @@ jobs:
3791
restore-keys: |
3892
${{ runner.os }}-go-
3993
40-
- name: Install dependencies
94+
- name: Restore binaries
95+
uses: actions/cache@v3
96+
with:
97+
path: |
98+
./mpcium
99+
./mpcium-cli
100+
key: ${{ needs.build.outputs.cache-key }}
101+
102+
- name: Install binaries
103+
run: |
104+
sudo mv mpcium /usr/local/bin/
105+
sudo mv mpcium-cli /usr/local/bin/
106+
107+
- name: Verify binaries are available
108+
run: |
109+
which mpcium
110+
which mpcium-cli
111+
mpcium --version || echo "mpcium binary ready"
112+
mpcium-cli --version || echo "mpcium-cli binary ready"
113+
114+
- name: Install E2E dependencies
41115
run: |
42-
go mod download
43116
cd e2e && go mod download
44117
45-
- name: Build mpcium binary
118+
- name: Run Key Generation E2E tests
46119
run: |
47-
go build -o mpcium ./cmd/mpcium
120+
cd e2e
121+
go test -v -timeout=600s -run TestKeyGeneration
122+
env:
123+
DOCKER_BUILDKIT: 1
48124

49-
- name: Build mpcium-cli binary
125+
- name: Cleanup Docker containers
126+
if: always()
50127
run: |
51-
go build -o mpcium-cli ./cmd/mpcium-cli
128+
cd e2e
129+
docker compose -f docker-compose.test.yaml down -v || true
130+
docker system prune -f || true
52131
53-
- name: Make binaries executable and add to PATH
132+
- name: Upload keygen test logs
133+
if: failure()
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: e2e-keygen-test-logs
137+
path: e2e/logs/
138+
retention-days: 7
139+
140+
# Signing E2E Tests
141+
e2e-signing:
142+
runs-on: ubuntu-latest
143+
needs: build
144+
145+
steps:
146+
- name: Checkout code
147+
uses: actions/checkout@v4
148+
149+
- name: Set up Go
150+
uses: actions/setup-go@v4
151+
with:
152+
go-version: "1.23"
153+
154+
- name: Set up Docker Buildx
155+
uses: docker/setup-buildx-action@v3
156+
157+
- name: Verify Docker Compose
158+
run: |
159+
docker --version
160+
docker compose version
161+
162+
- name: Cache Go modules
163+
uses: actions/cache@v3
164+
with:
165+
path: |
166+
~/.cache/go-build
167+
~/go/pkg/mod
168+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
169+
restore-keys: |
170+
${{ runner.os }}-go-
171+
172+
- name: Restore binaries
173+
uses: actions/cache@v3
174+
with:
175+
path: |
176+
./mpcium
177+
./mpcium-cli
178+
key: ${{ needs.build.outputs.cache-key }}
179+
180+
- name: Install binaries
54181
run: |
55-
chmod +x mpcium mpcium-cli
56182
sudo mv mpcium /usr/local/bin/
57183
sudo mv mpcium-cli /usr/local/bin/
58184
@@ -63,10 +189,92 @@ jobs:
63189
mpcium --version || echo "mpcium binary ready"
64190
mpcium-cli --version || echo "mpcium-cli binary ready"
65191
66-
- name: Run E2E tests
192+
- name: Install E2E dependencies
193+
run: |
194+
cd e2e && go mod download
195+
196+
- name: Run Signing E2E tests
67197
run: |
68198
cd e2e
69-
go test -v -timeout=600s -run TestKeyGeneration
199+
go test -v -timeout=600s -run TestSigning
200+
env:
201+
DOCKER_BUILDKIT: 1
202+
203+
- name: Cleanup Docker containers
204+
if: always()
205+
run: |
206+
cd e2e
207+
docker compose -f docker-compose.test.yaml down -v || true
208+
docker system prune -f || true
209+
210+
- name: Upload signing test logs
211+
if: failure()
212+
uses: actions/upload-artifact@v4
213+
with:
214+
name: e2e-signing-test-logs
215+
path: e2e/logs/
216+
retention-days: 7
217+
218+
# Resharing E2E Tests
219+
e2e-resharing:
220+
runs-on: ubuntu-latest
221+
needs: build
222+
223+
steps:
224+
- name: Checkout code
225+
uses: actions/checkout@v4
226+
227+
- name: Set up Go
228+
uses: actions/setup-go@v4
229+
with:
230+
go-version: "1.23"
231+
232+
- name: Set up Docker Buildx
233+
uses: docker/setup-buildx-action@v3
234+
235+
- name: Verify Docker Compose
236+
run: |
237+
docker --version
238+
docker compose version
239+
240+
- name: Cache Go modules
241+
uses: actions/cache@v3
242+
with:
243+
path: |
244+
~/.cache/go-build
245+
~/go/pkg/mod
246+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
247+
restore-keys: |
248+
${{ runner.os }}-go-
249+
250+
- name: Restore binaries
251+
uses: actions/cache@v3
252+
with:
253+
path: |
254+
./mpcium
255+
./mpcium-cli
256+
key: ${{ needs.build.outputs.cache-key }}
257+
258+
- name: Install binaries
259+
run: |
260+
sudo mv mpcium /usr/local/bin/
261+
sudo mv mpcium-cli /usr/local/bin/
262+
263+
- name: Verify binaries are available
264+
run: |
265+
which mpcium
266+
which mpcium-cli
267+
mpcium --version || echo "mpcium binary ready"
268+
mpcium-cli --version || echo "mpcium-cli binary ready"
269+
270+
- name: Install E2E dependencies
271+
run: |
272+
cd e2e && go mod download
273+
274+
- name: Run Resharing E2E tests
275+
run: |
276+
cd e2e
277+
go test -v -timeout=600s -run TestResharing
70278
env:
71279
DOCKER_BUILDKIT: 1
72280

@@ -77,11 +285,35 @@ jobs:
77285
docker compose -f docker-compose.test.yaml down -v || true
78286
docker system prune -f || true
79287
80-
- name: Upload test logs
288+
- name: Upload resharing test logs
81289
if: failure()
82290
uses: actions/upload-artifact@v4
83291
with:
84-
name: e2e-test-logs
292+
name: e2e-resharing-test-logs
85293
path: e2e/logs/
86294
retention-days: 7
87295

296+
# Summary job that depends on all E2E tests
297+
e2e-summary:
298+
runs-on: ubuntu-latest
299+
needs: [e2e-keygen, e2e-signing, e2e-resharing]
300+
if: always()
301+
302+
steps:
303+
- name: Check E2E test results
304+
run: |
305+
echo "E2E Test Results Summary:"
306+
echo "========================="
307+
echo "Key Generation Tests: ${{ needs.e2e-keygen.result }}"
308+
echo "Signing Tests: ${{ needs.e2e-signing.result }}"
309+
echo "Resharing Tests: ${{ needs.e2e-resharing.result }}"
310+
echo ""
311+
312+
# Check if any tests failed
313+
if [[ "${{ needs.e2e-keygen.result }}" != "success" || "${{ needs.e2e-signing.result }}" != "success" || "${{ needs.e2e-resharing.result }}" != "success" ]]; then
314+
echo "❌ One or more E2E tests failed"
315+
exit 1
316+
else
317+
echo "✅ All E2E tests passed successfully"
318+
fi
319+

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build clean mpcium mpc test test-verbose test-coverage e2e-test e2e-clean
1+
.PHONY: all build clean mpcium mpc test test-verbose test-coverage e2e-test e2e-clean cleanup-test-env
22

33
BIN_DIR := bin
44

@@ -44,6 +44,11 @@ e2e-clean:
4444
@echo "Cleaning up E2E test artifacts..."
4545
cd e2e && make clean
4646

47+
# Comprehensive cleanup of test environment (kills processes, removes artifacts)
48+
cleanup-test-env:
49+
@echo "Performing comprehensive test environment cleanup..."
50+
cd e2e && ./cleanup_test_env.sh
51+
4752
# Run all tests (unit + E2E)
4853
test-all: test e2e-test
4954

e2e/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ clean:
3232
rm -f test_event_initiator.*
3333
rm -rf logs
3434
rm -rf coverage.*
35+
rm config.test.yaml
3536
docker compose -f docker-compose.test.yaml down --remove-orphans 2>/dev/null || true
3637

3738
# Run tests with coverage

0 commit comments

Comments
 (0)