ci: Add PING test for ci

This commit is contained in:
yuanjm
2022-06-08 16:14:01 +08:00
parent b9b1a7aba8
commit 16cf6d7bf3

View File

@@ -143,6 +143,16 @@ def test_examples_protocol_https_wss_server(dut: Dut) -> None:
raise RuntimeError('Failed to receive the correct echo response') raise RuntimeError('Failed to receive the correct echo response')
logging.info('Correct echo response obtained from the wss server') logging.info('Correct echo response obtained from the wss server')
# Test for PING
logging.info('Testing for send PING')
ws.write(data=DATA, opcode=OPCODE_PING)
dut.expect('Got a WS PING frame, Replying PONG')
opcode, data = ws.read()
data = data.decode('UTF-8')
if data != DATA or opcode != OPCODE_PONG:
raise RuntimeError('Failed to receive the PONG response')
logging.info('Passed the test for PING')
# Test for keepalive # Test for keepalive
logging.info('Testing for keep alive (approx time = 20s)') logging.info('Testing for keep alive (approx time = 20s)')
start_time = time.time() start_time = time.time()