Repository navigation
138 lines (130 loc) · 7.52 KB
/
Copy pathintegration_tests.yml
File metadata and controls
138 lines (130 loc) · 7.52 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Runs the integration test suite.
#
# The suite flow lives in the composite action
# .github/actions/integration-tests; only the matrix/sharding strategy and
# the result uploads live here.
name: Integration Tests
on:
workflow_call:
inputs:
publish:
type: boolean
description: "Whether to publish the results"
required: true
run-tests:
type: boolean
description: "Whether to run integration tests"
required: false
default: true
full-matrix:
type: boolean
description: "When true (main), run all three compression configs unsharded. When false (PRs), split the full-suite uncompressed config into package shards on parallel runners to cut wall time; the compressed configs run their allow-list unsharded either way."
required: false
default: true
jobs:
run:
if: ${{ inputs.run-tests == true }}
runs-on: infra-tests
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
# Coverage is split along two independent axes:
#
# - Which tests run per config: the uncompressed config runs the
# whole suite; the compressed configs (zstd1/lz4) only re-run the
# allow-listed tests whose subject is writing or reading back a
# snapshot, which is all the compression knobs can affect (see
# scripts/compression-tests.tsv).
# - Sharding for wall time (PRs only): each host saturates at
# go test -parallel=4 (Firecracker boots + compression), so the
# only way to cut wall time is more hosts. The full-suite
# uncompressed config is split into package shards - the
# TestTemplateBuild* tests (real FC builds) in two halves by name
# prefix, api/sandboxes plus the light packages on their own
# runner, everything else on the last one. The compressed
# allow-list runs are split at the package level: the templates
# package (real-build snapshot tests) vs everything else. Shards
# are resolved by TEST_SHARD in tests/integration/Makefile.
#
# On push to main (full-matrix), all three configs run unsharded, one
# job per config, as before.
include: >-
${{ fromJSON(inputs.full-matrix
&& '[
{"name": "uncompressed", "shard": "all", "compress_enabled": "false", "compress_type": "", "compress_level": "", "compress_workers": "", "dedup_mode": "default", "disable_memfd": "true"},
{"name": "zstd1", "shard": "all", "compress_enabled": "true", "compress_type": "zstd", "compress_level": "1", "compress_workers": "8", "dedup_mode": "best_effort", "disable_memfd": "false"},
{"name": "lz4", "shard": "all", "compress_enabled": "true", "compress_type": "lz4", "compress_level": "0", "compress_workers": "8", "dedup_mode": "direct_io", "disable_memfd": "false"}
]'
|| '[
{"name": "uncompressed-templates-1", "shard": "templates-builds-1", "compress_enabled": "false", "compress_type": "", "compress_level": "", "compress_workers": "", "dedup_mode": "default", "disable_memfd": "true"},
{"name": "uncompressed-templates-2", "shard": "templates-builds-2", "compress_enabled": "false", "compress_type": "", "compress_level": "", "compress_workers": "", "dedup_mode": "default", "disable_memfd": "true"},
{"name": "uncompressed-sandboxes", "shard": "sandboxes", "compress_enabled": "false", "compress_type": "", "compress_level": "", "compress_workers": "", "dedup_mode": "default", "disable_memfd": "true"},
{"name": "uncompressed-rest", "shard": "rest", "compress_enabled": "false", "compress_type": "", "compress_level": "", "compress_workers": "", "dedup_mode": "default", "disable_memfd": "true"},
{"name": "zstd1-templates", "shard": "templates", "compress_enabled": "true", "compress_type": "zstd", "compress_level": "1", "compress_workers": "8", "dedup_mode": "best_effort", "disable_memfd": "false"},
{"name": "zstd1-other", "shard": "no-templates", "compress_enabled": "true", "compress_type": "zstd", "compress_level": "1", "compress_workers": "8", "dedup_mode": "best_effort", "disable_memfd": "false"},
{"name": "lz4-templates", "shard": "templates", "compress_enabled": "true", "compress_type": "lz4", "compress_level": "0", "compress_workers": "8", "dedup_mode": "direct_io", "disable_memfd": "false"},
{"name": "lz4-other", "shard": "no-templates", "compress_enabled": "true", "compress_type": "lz4", "compress_level": "0", "compress_workers": "8", "dedup_mode": "direct_io", "disable_memfd": "false"}
]') }}
env:
# Build race-instrumented but optimized binaries: nobody attaches a
# debugger in CI, and -N -l slows both compilation and every test at
# runtime. Set at the job level so the build-packages step and the
# rebuilds inside the run/run-debug targets use identical flags (the
# second build is then a Go build cache no-op).
DEBUG_GCFLAGS: ""
# The Makefiles already default an unset RACE_FLAG to -race; set it
# explicitly so the build-packages cache key sees the variant it labels.
RACE_FLAG: "-race"
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Run integration tests
uses: ./.github/actions/integration-tests
with:
compress_enabled: ${{ matrix.compress_enabled }}
compress_type: ${{ matrix.compress_type }}
compress_level: ${{ matrix.compress_level }}
compress_workers: ${{ matrix.compress_workers }}
dedup_mode: ${{ matrix.dedup_mode }}
disable_memfd: ${{ matrix.disable_memfd }}
test-shard: ${{ matrix.shard }}
# The uncompressed config runs the whole suite. The compressed
# configs only re-run the tests whose subject is writing or reading
# back a snapshot, which is all the compression knobs can affect —
# the allow-list documents the criteria and the code paths involved.
tests-only: ${{ matrix.compress_enabled == 'true' && 'scripts/compression-tests.tsv' || '' }}
- name: Upload Test Results
if: ${{ always() && inputs.publish == true }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Integration Tests Results (${{ matrix.name }})
path: ./tests/integration/test-results.xml
- name: Upload Service Logs
if: ${{ always() && inputs.publish == true }}
# Diagnostics only; a flaky or hung upload must not fail a green shard.
continue-on-error: true
timeout-minutes: 5
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Service Logs (${{ matrix.name }})
path: ~/logs/*.log
integration_tests:
needs: run
if: ${{ always() }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Aggregate matrix result
run: |
if [[ "${{ inputs.run-tests }}" != "true" ]]; then
echo "integration tests skipped because test inputs did not change"
exit 0
fi
if [[ "${{ needs.run.result }}" != "success" ]]; then
echo "matrix result: ${{ needs.run.result }}"
exit 1
fi
echo "all matrix shards succeeded"