-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (49 loc) · 2.02 KB
/
test_push.yml
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
name: test-push
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- 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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
- 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