-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (72 loc) · 2.67 KB
/
e2e-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
71
72
73
# Modified from https://github.com/prometheus-operator/prometheus-operator/blob/main/.github/workflows/e2e-feature-gated.yaml
name: e2e-tests
on:
push:
branches:
- main
tags:
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
NETBOX_HOST: demo.netbox.dev
AUTH_TOKEN: 0123456789abcdef0123456789abcdef01234567
POD_NAMESPACE: default
HTTPS_ENABLE: true
NETBOX_RESTORATION_HASH_FIELD_NAME: netboxOperatorRestorationHash
jobs:
e2e-tests:
name: E2E tests for netbox operator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: 1.23.4
- name: Import environment variables from file
run: |
cat ".github/env" >> "$GITHUB_ENV"
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
- name: Start kind cluster
uses: helm/kind-action@ae94020eaf628e9b9b9f341a10cc0cdcf5c018fb # v1.11.0
with:
version: ${{ env.kind-version }}
node_image: ${{ env.kind-image }}
wait: 300s
config: ./tests/e2e/kind-config.yaml
cluster_name: e2e
- name: Wait for cluster to finish bootstraping
run: |
echo "Waiting for all nodes to be ready..."
kubectl wait --for=condition=Ready nodes --all --timeout=120s
kubectl get nodes
echo "Waiting for all pods to be ready..."
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
kubectl get pods -A
echo "Cluster information"
kubectl cluster-info
- name: Setup kind cluster with required software such as NetBox
run: |
make create-kind
- name: Deploy NetBox operator to the kind cluster
run: |
make deploy-kind
- name: Run tests
env:
E2E_DIAGNOSTIC_DIRECTORY: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }}
run: |
# # Very straight forward way of implementing a test and checking the result
# kubectl apply -f config/samples/netbox_v1_prefixclaim.yaml
# kubectl get prefixclaim,prefix,ipaddressclaim,ipaddress,iprange,iprangeclaim
# kubectl wait --for=condition=ready --timeout=30s prefixclaim.netbox.dev/prefixclaim-sample
# Use Chainsaw
make test-e2e
- name: Upload diagnostics artifact
if: ${{ failure() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: cluster-state
path: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }}
retention-days: 15