forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonrpc.at
29 lines (26 loc) · 1.08 KB
/
jsonrpc.at
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
AT_BANNER([JSON-RPC - C])
AT_SETUP([JSON-RPC request and successful reply])
AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
on_exit 'kill `cat test-jsonrpc.pid`'
AT_CHECK(
[[ovstest test-jsonrpc request unix:socket echo '[{"a": "b", "x": null}]']], [0],
[[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
]])
AT_CLEANUP
AT_SETUP([JSON-RPC request and error reply])
AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
on_exit 'kill `cat test-jsonrpc.pid`'
AT_CHECK(
[[ovstest test-jsonrpc request unix:socket bad-request '[]']], [0],
[[{"error":{"error":"unknown method"},"id":0,"result":null}
]])
AT_CLEANUP
AT_SETUP([JSON-RPC notification])
AT_CHECK([ovstest test-jsonrpc --detach --no-chdir --pidfile listen punix:socket])
on_exit 'kill `cat test-jsonrpc.pid`'
# Check that the pidfile got created.
AT_CHECK([test -e test-jsonrpc.pid])
AT_CHECK([[ovstest test-jsonrpc notify unix:socket shutdown '[]']])
# Wait for test-jsonrpc to die, based on its pidfile disappearing
OVS_WAIT_WHILE([test -e test-jsonrpc.pid])
AT_CLEANUP