Skip to content

Restore testing on a live cluster #167

Restore testing on a live cluster

Restore testing on a live cluster #167

Workflow file for this run

name: test-push
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
test-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Build Docker image
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
id: build_docker
with:
context: .
push: false
- name: Check Docker image
run: docker run ${{ steps.build_docker.outputs.digest }} -h
test-docker-ubi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Build Docker image
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
id: build_docker
with:
context: .
file: Dockerfile.ubi
push: false
- name: Check Docker image
run: docker run ${{ steps.build_docker.outputs.digest }} -h
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- run: pip install flake8
- name: Lint with flake8
run: flake8 nca --count --max-complexity=15 --max-line-length=127 --statistics
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- run: |
export PYTHONPATH=.
python tests/run_unittests.py
k8s-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- name: install helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
sudo ./get_helm.sh
- name: Run k8s tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=k8s --check_run_time | tee tests/k8s_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_k8s_tests log
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: k8s-log
path: tests/k8s_log.txt
- name: Upload k8s failed run-time tests file
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: k8s-failed-run-time-check-file
path: ./tests/k8s_tests_failed_runtime_check.csv
if-no-files-found: ignore
calico-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- name: Run calico tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=calico --check_run_time | tee tests/calico_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_calico_tests log
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: calico-log
path: tests/calico_log.txt
- name: Upload calico failed run-time tests file
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: calico-failed-run-time-check-file
path: ./tests/calico_tests_failed_runtime_check.csv
if-no-files-found: ignore
istio-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- name: Run istio tests
env:
GHE_TOKEN: ${{ github.token }}
PYTHONPATH: .
run: python tests/run_all_tests.py --type=general --category=istio --check_run_time | tee tests/istio_log.txt ; test ${PIPESTATUS[0]} -eq 0
- name: upload run_istio_tests log
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: istio-log
path: tests/istio_log.txt
- name: Upload istio failed run-time tests file
if: ${{ always() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: istio-failed-run-time-check-file
path: ./tests/istio_tests_failed_runtime_check.csv
if-no-files-found: ignore
fw-rules-assertion-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- run: |
export PYTHONPATH=.
python tests/run_all_tests.py --type=fw_rules_assertions
live-cluster:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- uses: helm/kind-action@d8ccf8fb623ce1bb360ae2f45f323d9d5c5e9f00
- run: |
curl -L https://istio.io/downloadIstio | sh -
cd istio-1.*
export PATH=$PWD/bin:$PATH
istioctl install --set profile=demo -y
- run: |
export PYTHONPATH=.
python tests/run_all_tests.py --type=k8s_live_general
build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: ./.github/actions/setup-nca-env
- name: Build package
run: |
pip install build==0.10.0
python -m build
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: nca-package
path: dist/*
test_package:
runs-on: ubuntu-latest
needs: build_package
steps:
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.9
architecture: x64
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
name: nca-package
path: nca_build
- run: |
pip install nca_build/network_config_analyzer-*.tar.gz
nca --connectivity -r https://github.com/np-guard/network-config-analyzer/blob/master/tests/livesim_tests/livesim_topology.yaml
env:
GHE_TOKEN: ${{ github.token }}