File: jsonrpc-py.at

package info (click to toggle)
openvswitch 3.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 97,848 kB
  • sloc: sh: 1,643,930; ansic: 313,386; python: 27,939; xml: 21,526; makefile: 546; javascript: 191
file content (31 lines) | stat: -rw-r--r-- 1,281 bytes parent folder | download | duplicates (3)
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
30
31
AT_BANNER([JSON-RPC - Python3])

AT_SETUP([JSON-RPC request and successful reply - Python3])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK(
  [[$PYTHON3 $srcdir/test-jsonrpc.py 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 - Python3])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK(
  [[$PYTHON3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
  [[{"error":{"error":"unknown method"},"id":0,"result":null}
]])
AT_CLEANUP

AT_SETUP([JSON-RPC notification - Python3])
AT_KEYWORDS([python jsonrpc])
AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
on_exit 'kill `cat test-jsonrpc.py.pid`'
AT_CHECK([test -e test-jsonrpc.py.pid])
AT_CHECK([[$PYTHON3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
# Wait for test-jsonrpc to die, based on its pidfile disappearing
OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
AT_CLEANUP