Bump actions/checkout from 3df4ab11eba7bda6032a0b82a6bb43b11571feac to b4ffde65f46336ab88eb53be808477a3936bae11 #92
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test-push | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- run: pip install -r requirements.txt | |
- run: pip install flake8 | |
- name: Lint with flake8 | |
run: flake8 nca_rest_server --count --max-complexity=15 --max-line-length=127 --statistics | |
rest-api: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- run: pip install -r requirements.txt | |
- run: | | |
python -m nca_rest_server & | |
NCA_PID=$! | |
while true; do # wait until REST server becomes responsive | |
curl_status=0 | |
curl localhost:5000 || curl_status=$? | |
[ $curl_status -gt 0 ] || break | |
sleep 1 | |
done | |
curl -X POST -H Content-Type:application/json -d @tests/basic/ns_list.json localhost:5000/namespace_list | |
curl -X POST -H Content-Type:application/json -d @tests/basic/pods_list.json localhost:5000/pod_list | |
curl -X POST -H Content-Type:application/json -d @tests/basic/testcase1-networkpolicy1.json localhost:5000/policy_sets | |
curl -X POST -H Content-Type:application/json -d @tests/basic/testcase2-networkpolicies.json localhost:5000/policy_sets | |
curl localhost:5000/policy_sets/set_0/findings -o testcase1_findings.json | |
diff testcase1_findings.json tests/basic/testcase1_expected_findings.json | |
curl localhost:5000/policy_sets/set_1/findings -o testcase2_findings.json | |
diff testcase2_findings.json tests/basic/testcase2_expected_findings.json | |
kill $NCA_PID |