Skip to content

Commit 2774206

Browse files
Merge pull request #20 from cristian-recoseanu/add-api-checks
Add API Testing checks
2 parents 0aefa95 + 7f5e2bf commit 2774206

File tree

3 files changed

+120
-1
lines changed

3 files changed

+120
-1
lines changed

.github/workflows/api_testing.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: API Testing
2+
on:
3+
pull_request:
4+
branches: [ "main" ]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python 3.9
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.9'
17+
18+
- name: Clone nmos-testing Repository
19+
run: git clone https://github.com/AMWA-TV/nmos-testing.git nmos-testing
20+
21+
- name: Install nmos-testing Requirements
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r nmos-testing/requirements.txt
25+
26+
- name: Verify Python and Packages
27+
run: |
28+
python --version
29+
pip --version
30+
pip list
31+
32+
- name: Install dependencies and build
33+
run: cargo build
34+
35+
- name: Start App
36+
run: |
37+
cargo run &
38+
echo $! > node_pid.txt
39+
40+
- name: Wait for app to be ready
41+
run: |
42+
for i in {1..20}; do
43+
if nc -z localhost 3000; then
44+
echo "Server is up!"
45+
exit 0
46+
fi
47+
echo "Waiting for server..."
48+
sleep 2
49+
done
50+
echo "Server did not start in time."
51+
exit 1
52+
53+
- name: Copy and show UserConfig.py
54+
run: |
55+
mkdir -p nmos-testing/nmostesting
56+
cp nmos-testing-config/UserConfig.py nmos-testing/nmostesting/UserConfig.py
57+
echo "Contents of copied UserConfig.py:"
58+
cat nmos-testing/nmostesting/UserConfig.py
59+
60+
- name: Run IS-12 Test Suite
61+
working-directory: nmos-testing
62+
run: |
63+
mkdir -p ../test_results
64+
python nmos-test.py suite IS-12-01 \
65+
--host 127.0.0.1 127.0.0.1 null null \
66+
--port 3000 3000 0 0 \
67+
--version v1.3 v1.0 v1.0 v1.0 \
68+
--urlpath null /ws null null \
69+
--output ../test_results/is_12_01_results.json || true
70+
71+
- name: Check IS-12 Test Results
72+
run: |
73+
RESULTS_FILE="test_results/is_12_01_results.json"
74+
if [ ! -f "$RESULTS_FILE" ]; then
75+
echo "ERROR: Results file $RESULTS_FILE not found"
76+
exit 1
77+
fi
78+
FAILED=$(jq -r '.results[] | select(.state=="Fail") | "\(.name): \(.state), detail: \(.detail // "")"' "$RESULTS_FILE")
79+
if [ -n "$FAILED" ]; then
80+
echo "❌ NMOS Test Failures:"
81+
echo "$FAILED"
82+
exit 1
83+
else
84+
echo "✅ All NMOS tests passed!"
85+
fi
86+
87+
- name: Stop App
88+
if: always()
89+
run: |
90+
if [ -f node_pid.txt ]; then
91+
kill $(cat node_pid.txt) || true
92+
fi
93+
pkill -f 'cargo run' || true

.github/workflows/pr_checks.yml renamed to .github/workflows/build_checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR Checks
1+
name: Build Checks
22

33
on:
44
push:

nmos-testing-config/UserConfig.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from . import Config as CONFIG
2+
3+
CONFIG.ENABLE_HTTPS = False
4+
5+
CONFIG.SDP_PREFERENCES = {
6+
**CONFIG.SDP_PREFERENCES,
7+
"channels": 16,
8+
"exactframerate": 25,
9+
"width": 1920,
10+
"height": 1080,
11+
"interlace": True,
12+
}
13+
14+
CONFIG.MS05_INVASIVE_TESTING = False
15+
16+
CONFIG.DNS_SD_MODE = 'multicast'
17+
18+
CONFIG.DNS_SD_ADVERT_TIMEOUT = 2
19+
20+
CONFIG.WS_MESSAGE_TIMEOUT = 5
21+
22+
CONFIG.MQTT_MESSAGE_TIMEOUT = 5
23+
24+
CONFIG.API_PROCESSING_TIMEOUT = 3
25+
26+
CONFIG.HTTP_TIMEOUT = 5

0 commit comments

Comments
 (0)