]> git.proxmox.com Git - ovs.git/blame - tests/jsonrpc.at
tests: Convert ovsdb-monitor-sort utility from Perl to Python.
[ovs.git] / tests / jsonrpc.at
CommitLineData
99155935 1AT_BANNER([JSON-RPC - C])
f2129093
BP
2
3AT_SETUP([JSON-RPC request and successful reply])
56120500
BP
4AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
5on_exit 'kill `cat test-jsonrpc.pid`'
f2129093 6AT_CHECK(
eadd1644 7 [[ovstest test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0],
f2129093 8 [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
56120500 9]])
f2129093
BP
10AT_CLEANUP
11
12AT_SETUP([JSON-RPC request and error reply])
56120500
BP
13AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
14on_exit 'kill `cat test-jsonrpc.pid`'
f2129093 15AT_CHECK(
eadd1644 16 [[ovstest test-jsonrpc request unix:socket bad-request '[]']], [0],
f2129093 17 [[{"error":{"error":"unknown method"},"id":0,"result":null}
56120500 18]])
f2129093
BP
19AT_CLEANUP
20
21AT_SETUP([JSON-RPC notification])
56120500
BP
22AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
23on_exit 'kill `cat test-jsonrpc.pid`'
24# Check that the pidfile got created.
25AT_CHECK([test -e test-jsonrpc.pid])
26AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']])
27# Wait for test-jsonrpc to die, based on its pidfile disappearing
28OVS_WAIT_WHILE([test -e test-jsonrpc.pid])
f2129093 29AT_CLEANUP