-
Notifications
You must be signed in to change notification settings - Fork 5
70 lines (60 loc) · 1.96 KB
/
tests.yaml
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
name: Tests
on:
workflow_dispatch:
workflow_call:
jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install dependencies
run: python -m pip install tox
- name: Run tests
run: tox -e unit
integration-test-microk8s:
name: Integration tests (microk8s)
runs-on: ubuntu-24.04
timeout-minutes: 90
needs:
- unit-test
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: 1.31-strict/stable
juju-channel: 3.6
- name: Run integration tests
# set a predictable model name so it can be consumed by charm-logdump-action
run: tox -e integration
- name: Get contexts
run: kubectl config view
if: failure()
- name: Get juju status
run: juju status --relations
if: failure()
- name: Dump debug log
if: failure()
run: |
for m in $(juju models --format json | jq -r '.models[].name' | grep -v "admin/controller"); do juju debug-log -m $m --replay --ms --no-tail; done
exit 0
- name: Dump pods and their logs
if: failure()
run: |
juju status --relations --storage
kubectl get pods \
-A \
-o=jsonpath='{range.items[*]}{.metadata.namespace} {.metadata.name}{"\n"}' \
--sort-by=.metadata.namespace \
| grep -v "^\s*$" \
| while read namespace pod; do \
kubectl -n $namespace describe pod $pod; \
kubectl -n $namespace logs $pod \
--all-containers=true \
--tail=100; \
done
exit 0