Skip to content

Commit aee8905

Browse files
committed
Update test scripts
1 parent 9a9b19c commit aee8905

File tree

4 files changed

+43
-23
lines changed

4 files changed

+43
-23
lines changed

.github/workflows/build-and-test.yml

+9-16
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ jobs:
2323
id: changed-files
2424
if: ${{ github.event_name != 'workflow_dispatch' }}
2525
uses: tj-actions/changed-files@v35
26-
with:
27-
since_last_remote_commit: false
2826

2927
- name: Determine charms to build/test
3028
id: determine-parts
@@ -101,7 +99,7 @@ jobs:
10199
- name: Upload built charm
102100
uses: actions/upload-artifact@v4
103101
with:
104-
name: charm-${{ matrix.part }}
102+
name: charm-artifact-${{ matrix.part }}
105103
path: "./${{ matrix.part }}/*.charm"
106104

107105
functional-test:
@@ -119,7 +117,8 @@ jobs:
119117
- name: Download charm
120118
uses: actions/download-artifact@v4
121119
with:
122-
name: charm-${{ matrix.part }}
120+
pattern: charm-artifact-*
121+
merge-multiple: true
123122
path: ~/artifacts/
124123

125124
- name: Checkout code
@@ -142,26 +141,20 @@ jobs:
142141
lxd init --minimal
143142
fi
144143
145-
- name: Install dependencies
144+
- name: Install and configure tests
146145
run: |
147-
sudo apt -y install tox
148-
if [ ! -d "$HOME/.local/share/juju" ]; then
149-
sudo snap install juju --channel=3.6/stable
150-
mkdir -p ~/.local/share/juju
151-
juju bootstrap localhost localhost
152-
fi
153-
154-
sudo snap install --classic juju-crashdump
146+
date
147+
~/actionutils.sh setup_functest
148+
~/actionutils.sh cacheimgs "ubuntu@22.04"
155149
156150
- name: Run the tests
157151
run: |
158152
date
159-
~/actionutils.sh cacheimgs "ubuntu:22.04"
160153
mv ~/artifacts/*.charm ./
161154
if [[ -f "./${{ matrix.part }}/src/tox.ini" ]]; then
162-
tox -c ${{ matrix.part }}/src -e func-target -- jammy-bobcat
155+
tox -c ${{ matrix.part }}/src -e func-dev
163156
else
164-
tox -c ${{ matrix.part }} -e func-target -- jammy-bobcat
157+
tox -c ${{ matrix.part }} -e func-dev
165158
fi
166159
167160
- name: Generate crash dumps

tests/configs/dot.zaza.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
model_settings:
3+
logging-config: "<root>=INFO;unit=DEBUG"
4+
5+
runtime_config:
6+
TEST_MAX_RESOLVE_COUNT: 5

tests/configs/model-defaults.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test-mode: true
2+
automatically-retry-hooks: true
3+
logging-config: "<root>=DEBUG"
4+
enable-os-upgrade: false

tests/scripts/actionutils.sh

+24-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,30 @@ function cleaript() {
1010
}
1111

1212
function cacheimgs() {
13-
lxc launch $1 ctemp 2>&1 >/dev/null
14-
lxc launch $1 vmtemp --vm -c limits.cpu=2 -c limits.memory=4GiB -d root,size=25GiB 2>&1 >/dev/null
15-
lxc stop ctemp
16-
lxc delete ctemp
17-
sleep 60
18-
lxc stop vmtemp
19-
lxc delete vmtemp
13+
local base="${1?missing}"
14+
juju add-model dummy
15+
juju add-machine --base "$base"
16+
sleep 10
17+
juju add-machine --base "$base" --constraints "virt-type=virtual-machine"
18+
while [ "$(juju machines | egrep -wc 'started')" -ne 2 ]; do
19+
sleep 2
20+
done
21+
juju destroy-model --force --timeout 20s --no-prompt dummy
22+
sleep 5
23+
}
24+
25+
function setup_functest() {
26+
sudo apt -y install tox
27+
if [ ! -d "$HOME/.local/share/juju" ]; then
28+
sudo snap install juju --channel=3.6/stable
29+
mkdir -p ~/.local/share/juju
30+
juju bootstrap \
31+
--auto-upgrade=false \
32+
--model-default=tests/configs/model-defaults.yaml \
33+
localhost localhost
34+
fi
35+
sudo snap install --classic juju-crashdump
36+
cp tests/configs/dot.zaza.yaml ~/.zaza.yaml
2037
}
2138

2239
run="${1}"

0 commit comments

Comments
 (0)