File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 2222 python-version : ${{ matrix.python }}
2323 - name : Install Dependencies
2424 run : |
25- pip install tox coveralls
25+ sudo apt-get update; sudo apt-get install socat
26+ pip install tox
2627 - name : Run Tox
2728 run : tox -e py
29+ - name : Run API test
30+ run : |
31+ wget https://raw.githubusercontent.com/UpdateHub/updatehub/master/doc/agent-http.yaml \
32+ -O agent-http.yaml
33+
34+ docker run \
35+ --rm \
36+ --detach=true \
37+ --name agent-sdk-python-mock \
38+ -p 8080:8000 \
39+ -v $PWD/agent-http.yaml:/api.yaml \
40+ danielgtaylor/apisprout@sha256:6c07143937e57095d8478efc8ab7eab52b44e67c7673285f8c0a2bf4a7b137ad \
41+ /api.yaml --validate-request
42+
43+ PYTHONPATH=. python examples/api.py
44+ - name : Run listener test
45+ run : |
46+ export UH_LISTENER_TEST=updatehub-statechange.sock
47+ PYTHONPATH=. python3.6 examples/state_change_listener.py &
48+
49+ while [ ! -S "$UH_LISTENER_TEST" ]; do
50+ sleep 1
51+ done
52+
53+ if [[ "$(echo "entry_point" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
54+ echo "Unexpected entry_point response"
55+ exit 1
56+ fi
57+ if [[ "$(echo "downloading" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "cancel" ]]; then
58+ echo "Unexpected downloading response"
59+ exit 2
60+ fi
61+ if [[ "$(echo "error foo" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "try_again 10" ]]; then
62+ echo "Unexpected error response"
63+ exit 3
64+ fi
65+ if [[ "$(echo "rebooting" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
66+ echo "Unexpected rebooting response"
67+ exit 4
68+ fi
2869
Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ updatehub_agent_sdk.egg-info/
99test-report.xml
1010* .pyc
1111coverage.xml
12+ agent-http.yaml
You can’t perform that action at this time.
0 commit comments