Skip to content

Commit

Permalink
add test cases for frontend-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandiH committed Jan 2, 2025
1 parent 0f647bf commit 47f6067
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/integration/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
jasminegraph:
image: jasminegraph:test
ports:
- '7776:7776'
- '7777:7777'
- '7778:7778'
volumes:
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

HOST = '127.0.0.1'
PORT = 7777 # The port used by the server
UI_PORT = 7776 # The port used by the frontend-ui

LIST = b'lst'
ADGR = b'adgr'
Expand Down Expand Up @@ -205,6 +206,24 @@ def test(host, port):
print(*failed_tests, sep='\n', file=sys.stderr)
sys.exit(1)

def test_ui(host, port):
"""Test the JasmineGraph server by sending a series of commands and checking the responses."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect((host, port))

print()
logging.info('Testing lst')
send_and_expect_response(sock, 'Initial lst', LIST, EMPTY)

if passed_all:
print()
logging.info('Passed all tests')
else:
print()
logging.critical('Failed some tests')
print(*failed_tests, sep='\n', file=sys.stderr)
sys.exit(1)

if __name__ == '__main__':
test(HOST, PORT)
test_ui(HOST, UI_PORT)

0 comments on commit 47f6067

Please sign in to comment.