-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (57 loc) · 2.24 KB
/
Copy pathcontract.yml
File metadata and controls
65 lines (57 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Contract tests
# Tier 3 of the test strategy (docs/test-strategy.md). Runs the
# drbd-utils contract suite — a thin docker container running real
# drbdmeta / drbdadm binaries against loopback files — to pin the
# byte-shape of every wrapper in pkg/drbd against the actual CLI.
#
# Catches the Bug-81 class: unit tests pass because FakeExec accepts
# any string, but the real drbdmeta rejects the flag combo. Runs on
# every PR; target wall-clock < 1 minute including image build.
#
# Linux-only — the harness skips on other GOOS values.
on:
# PR runs go through .github/workflows/pull-request.yml (consolidated
# pipeline with the breakpoint step). Push-only here so main-branch
# merges still exercise contract tests.
push:
branches: [main]
permissions: {}
jobs:
contract:
permissions:
contents: read
name: Contract (drbd-utils in docker)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Clone
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
# The harness builds the image lazily on first test via
# sync.Once. We pre-build it here so the build step's logs are
# separated from test logs, which makes triage easier when the
# image build itself breaks (e.g. alpine moved drbd-utils to a
# different repo).
- name: Build contract image
run: |
docker build -t blockstor-drbd-contract:local \
-f tests/contract/Dockerfile tests/contract/
docker images blockstor-drbd-contract:local
- name: Contract tests
# pipefail: without it `| tee` masks go test's exit code and
# the job goes green even when the suite fails.
run: |
set -o pipefail
go test -tags=contract -count=1 -timeout=5m -v ./tests/contract/... \
| tee contract.log
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: contract-logs
path: contract.log