Skip to content

Commit

Permalink
remove useless commands from testscript tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prog-supdex committed Sep 26, 2024
1 parent be08c3a commit cc2c05b
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 52 deletions.
5 changes: 1 addition & 4 deletions testdata/claim_conflict.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand All @@ -21,5 +18,5 @@ stdout '201'
exec curl -s -o /dev/null -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint
stdout '409'

# Stop the server
# Kill the process (stop the server)
kill server_process_test
5 changes: 1 addition & 4 deletions testdata/claim_license_conflict.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand All @@ -25,5 +22,5 @@ stdout '409'

exec grep '{"error":"License claim conflict, heartbeat disabled"}' response.txt

# Stop the server
# Kill the process (stop the server)
kill server_process_test
5 changes: 1 addition & 4 deletions testdata/claim_license_extended.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand All @@ -25,5 +22,5 @@ stdout '202'
exec grep '"license_file":' response.txt
exec grep '"license_key":' response.txt

# Stop the server
# Kill the process (stop the server)
kill server_process_test
9 changes: 5 additions & 4 deletions testdata/claim_license_lifo_strategy.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Remove existing database
rm -f relay.sqlite

# Add two licenses

# Add the first license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

# Give a pause between adding licenses
exec sleep 1

# Add the second license
exec relay add --file license_2.lic --key 9A96B8-FD08CD-8C433B-7657C8-8A8655-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

# Set a port and strategy as environment variables
Expand All @@ -22,11 +22,12 @@ exec sleep 1
# Claim a license (LIFO: should return the last license)
exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint

# List all licenses for verifying
exec relay ls --plain

# Expect the first license to be returned
exec grep '"license_file":' response.txt
exec grep '"license_key":"9A96B8-FD08CD-8C433B-7657C8-8A8655-V3"' response.txt

# Stop the server
# Kill the process (stop the server)
kill server_process_test
5 changes: 2 additions & 3 deletions testdata/claim_license_success.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Remove existing database
rm -f relay.sqlite


# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788
Expand All @@ -23,5 +22,5 @@ stdout '201'
exec grep '"license_file":' response.txt
exec grep '"license_key":' response.txt

# Stop the server
# Kill the process (stop the server)
kill server_process_test
4 changes: 2 additions & 2 deletions testdata/claim_no_licenses_available.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Remove existing database
rm -f relay.sqlite


# Start the server without adding any licenses
env PORT=8084
Expand All @@ -15,4 +14,5 @@ exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/
stdout '410'
exec grep 'No licenses available' response.txt

# Kill the process (stop the server)
kill server_process_test
3 changes: 0 additions & 3 deletions testdata/cmd_add.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

exec ls

# Add the license
Expand Down
3 changes: 0 additions & 3 deletions testdata/cmd_del.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand Down
8 changes: 1 addition & 7 deletions testdata/cmd_serve.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand All @@ -25,8 +22,5 @@ exec curl -s -X DELETE http://localhost:$PORT/v1/nodes/test_fingerprint
# Expect no content in the response
stdout ''

# Stop the server
# Kill the process (stop the server)
kill server_process

# Wait for the server to terminate
# wait server_process
3 changes: 0 additions & 3 deletions testdata/cmd_stat.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand Down
5 changes: 1 addition & 4 deletions testdata/release_license_not_found.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Start the server
env PORT=8086
exec relay serve --port $PORT &server_process_test&
Expand All @@ -15,5 +12,5 @@ exec curl -s -o response.txt -w "%{http_code}" -X DELETE http://localhost:$PORT/
stdout '404'
exec grep '{"error":"Claim not found"}' response.txt

# Stop the server
# Kill the process (stop the server)
kill server_process_test
5 changes: 1 addition & 4 deletions testdata/release_license_success.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add the license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand All @@ -21,5 +18,5 @@ stdout '201'
exec curl -s -o /dev/null -w "%{http_code}" -X DELETE http://localhost:$PORT/v1/nodes/test_fingerprint
stdout '204'

# Stop the server
# Kill the process (stop the server)
kill server_process_test
4 changes: 2 additions & 2 deletions testdata/server_database.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --
exec test -f $DATABASE_PATH

# Set a port as environment variable
env PORT=8087
env PORT=8091

# Start the server with custom database path
exec relay serve --port $PORT --database $DATABASE_PATH &server_process_test&
Expand All @@ -25,7 +25,7 @@ exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/
# Expect a success response (status 201)
stdout '201'

# Stop the server
# Kill the process (stop the server)
kill server_process_test

# Clean up the custom database
Expand Down
7 changes: 2 additions & 5 deletions testdata/server_ttl.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Remove existing database
rm -f relay.sqlite

# Add a license
exec relay add --file license.lic --key 9E32DD-D8CC22-771926-C2D834-C506DC-V3 --public-key e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788

Expand All @@ -23,7 +20,7 @@ stdout '201'
# Claim the license again before TTL expires
exec curl -s -o response_extend.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint

# Expect a license extension (status 202 Accepted)
# Expect a license extension (status 202)
stdout '202'

# Wait for the TTL to expire and cleanup interval to run
Expand All @@ -35,5 +32,5 @@ exec curl -s -o response_after_ttl.txt -w "%{http_code}" -X PUT http://localhost
# The license should have expired, allowing another claim (status 201 Created)
stdout '201'

# Stop the server
# Kill the process (stop the server)
kill server_process_test

0 comments on commit cc2c05b

Please sign in to comment.