Skip to content

Migrate populating local demo data through database.sql to using NetBox API #82

Migrate populating local demo data through database.sql to using NetBox API

Migrate populating local demo data through database.sql to using NetBox API #82

Workflow file for this run

# 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