]> git.proxmox.com Git - mirror_ovs.git/blob - tests/jsonrpc-py.at
ofp-print: Abbreviate lists of fields in table features output.
[mirror_ovs.git] / tests / jsonrpc-py.at
1 AT_BANNER([JSON-RPC - Python3])
2
3 AT_SETUP([JSON-RPC request and successful reply - Python3])
4 AT_KEYWORDS([python jsonrpc])
5 AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
6 on_exit 'kill `cat test-jsonrpc.py.pid`'
7 AT_CHECK(
8 [[$PYTHON3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
9 [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
10 ]])
11 AT_CLEANUP
12
13 AT_SETUP([JSON-RPC request and error reply - Python3])
14 AT_KEYWORDS([python jsonrpc])
15 AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
16 on_exit 'kill `cat test-jsonrpc.py.pid`'
17 AT_CHECK(
18 [[$PYTHON3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
19 [[{"error":{"error":"unknown method"},"id":0,"result":null}
20 ]])
21 AT_CLEANUP
22
23 AT_SETUP([JSON-RPC notification - Python3])
24 AT_KEYWORDS([python jsonrpc])
25 AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
26 on_exit 'kill `cat test-jsonrpc.py.pid`'
27 AT_CHECK([test -e test-jsonrpc.py.pid])
28 AT_CHECK([[$PYTHON3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
29 # Wait for test-jsonrpc to die, based on its pidfile disappearing
30 OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
31 AT_CLEANUP