-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathspread.yaml
More file actions
99 lines (86 loc) · 3.2 KB
/
spread.yaml
File metadata and controls
99 lines (86 loc) · 3.2 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
project: ubuntu-release
kill-timeout: 90m
workers: 1
environment:
CI: "$(HOST: echo $CI)"
CGO_ENABLED: 0
backends:
lxd:
type: adhoc
# This allocate block can be removed once the LXD VM support is landed in
# spread: https://github.com/canonical/spread/pull/185
allocate: |
CONTAINER_NAME="ubuntu-release-${SPREAD_SYSTEM/./-}-${RANDOM}"
DISK="${DISK:-20}"
CPU="${CPU:-4}"
MEM="${MEM:-8}"
lxc launch --vm \
"${SPREAD_SYSTEM/-/:}" \
"${CONTAINER_NAME}" \
-c user.user-data="$(sed "s|SPREAD_PASSWORD|$SPREAD_PASSWORD|g" charm/tests/spread/cloud-config.yaml)" \
-c limits.cpu="${CPU}" \
-c limits.memory="${MEM}GiB" \
-d root,size="${DISK}GiB"
# Wait for the spread user
while ! lxc exec "${CONTAINER_NAME}" -- id -u spread &>/dev/null; do sleep 0.5; done
# Set the instance address for spread
ADDRESS "$(lxc ls -f csv | grep "${CONTAINER_NAME}" | cut -d"," -f3 | cut -d" " -f1)"
discard: |
instance_name="$(lxc ls -f csv | grep $SPREAD_SYSTEM_ADDRESS | cut -f1 -d",")"
lxc delete -f $instance_name
systems:
- ubuntu-24.04:
username: spread
workers: 1
suites:
tests/:
summary: Integration tests for `ubuntu-release`
prepare-each: |
sudo apt-get update
sudo apt-get install -y git
git config --global --add safe.directory /root/proj
sudo snap install go --classic
go build -o /usr/bin/ubuntu-release-worker ${SPREAD_PATH}/cmd/ubuntu-release-worker
go build -o /usr/bin/ubuntu-release ${SPREAD_PATH}/cmd/ubuntu-release
pushd "$SPREAD_PATH"
charm/tests/spread/integration/:
summary: Spread tests - charm integration tests
environment:
CONCIERGE_JUJU_CHANNEL/juju_3_6: 3.6/stable
prepare-each: |
snap install --classic concierge
concierge prepare --trace -p machine --extra-snaps astral-uv --extra-debs make
pushd "$SPREAD_PATH"
# This is a performance optimisation to prevent the need to rebuild the charm
# every time the test is run. If the charm is not found, the test suite
# will automatically build it anyway.
if [[ -f "$SPREAD_PATH/charm/ubuntu-release-worker_ubuntu@24.04-amd64.charm" ]]; then
chown $(id -u):$(id -g) $SPREAD_PATH/charm/ubuntu-release-worker_ubuntu@24.04-amd64.charm
fi
restore-each: |
if [[ -z "${CI:-}" ]]; then
concierge restore --trace
apt autoremove -y --purge
rm -Rf "$SPREAD_PATH"
mkdir -p "$SPREAD_PATH"
fi
charm/tests/spread/functional/:
summary: Spread tests - functional tests
prepare-each: |
sudo apt-get update
sudo apt-get install -y make git
git config --global --add safe.directory /root/proj
sudo snap install --classic astral-uv
sudo snap install --classic go
go build -o "${SPREAD_PATH}/charm/ubuntu-release-worker" ${SPREAD_PATH}/cmd/ubuntu-release-worker
exclude:
- .coverage
- .github
- .pytest_cache
- .ruff_cache
- .tox
- .venv
# this needs to be under /root because spread executes the test scripts
# as root, which means that juju can only see files in root's
# home directory due to snap confinement.
path: /root/proj