-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5aef3b
commit be08c3a
Showing
16 changed files
with
569 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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 | ||
|
||
# Set a port as environment variable | ||
env PORT=8082 | ||
|
||
# Start the server with heartbeat disabled | ||
exec relay serve --port $PORT --no-heartbeats &server_process_test& | ||
|
||
# Wait for the server to start | ||
exec sleep 1 | ||
|
||
# Claim the license for the first time and check status code directly | ||
exec curl -s -o /dev/null -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
stdout '201' | ||
|
||
# Claim the license again with the same fingerprint and check status code directly | ||
exec curl -s -o /dev/null -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
stdout '409' | ||
|
||
# Stop the server | ||
kill server_process_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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 | ||
|
||
# Set a port as environment variable | ||
env PORT=8083 | ||
|
||
# Start the server with heartbeat disabled | ||
exec relay serve --port $PORT --no-heartbeats &server_process_test& | ||
|
||
# Wait for the server to start | ||
exec sleep 1 | ||
|
||
# Claim the license for the first time | ||
exec curl -s -o /dev/null -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
stdout '201' | ||
|
||
# Claim the license again with the same fingerprint | ||
exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
|
||
# Expect a conflict response with status code 409 and error message | ||
stdout '409' | ||
|
||
exec grep '{"error":"License claim conflict, heartbeat disabled"}' response.txt | ||
|
||
# Stop the server | ||
kill server_process_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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 | ||
|
||
# Set a port as environment variable | ||
env PORT=8087 | ||
|
||
# Start the server with heartbeat enabled (for extension to work) | ||
exec relay serve --port $PORT &server_process_test& | ||
|
||
# Wait for the server to start | ||
exec sleep 1 | ||
|
||
# Claim a license for the first time | ||
exec curl -s -o /dev/null -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
stdout '201' | ||
|
||
# Claim the license again with the same fingerprint to trigger an extension | ||
exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
stdout '202' | ||
|
||
# Expect the response to contain "license_file" and "license_key" fields for extended license | ||
exec grep '"license_file":' response.txt | ||
exec grep '"license_key":' response.txt | ||
|
||
# Stop the server | ||
kill server_process_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Remove existing database | ||
rm -f relay.sqlite | ||
|
||
# Add two licenses | ||
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 | ||
|
||
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 | ||
env PORT=8089 | ||
env STRATEGY=lifo | ||
|
||
# Start the server with FIFO strategy | ||
exec relay serve --port $PORT --strategy $STRATEGY &server_process_test& | ||
|
||
# Wait for the server to start | ||
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 | ||
|
||
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 server_process_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 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 | ||
|
||
# Set a port as environment variable | ||
env PORT=8090 | ||
|
||
# Start the server with heartbeat disabled | ||
exec relay serve --port $PORT &server_process_test& | ||
|
||
# Wait for the server to start | ||
exec sleep 1 | ||
|
||
# Claim a license | ||
exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
|
||
# Expect a success response with status code 201 | ||
stdout '201' | ||
|
||
# Check that the response contains license_file and license_key fields (using grep) | ||
exec grep '"license_file":' response.txt | ||
exec grep '"license_key":' response.txt | ||
|
||
# Stop the server | ||
kill server_process_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Remove existing database | ||
rm -f relay.sqlite | ||
|
||
# Start the server without adding any licenses | ||
env PORT=8084 | ||
exec relay serve --port $PORT &server_process_test& | ||
|
||
# Wait for the server to start | ||
exec sleep 1 | ||
|
||
# Attempt to claim a license when none are available | ||
exec curl -s -o response.txt -w "%{http_code}" -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
|
||
# Expect a gone response with status code 410 and error message | ||
stdout '410' | ||
exec grep 'No licenses available' response.txt | ||
|
||
kill server_process_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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 | ||
|
||
# Confirm the license is added | ||
exec relay ls --plain | ||
stdout 'dcea31a4-1664-4633-9f52-4a1b0b5ea2ef' | ||
|
||
# Delete the license | ||
exec relay del --id dcea31a4-1664-4633-9f52-4a1b0b5ea2ef | ||
|
||
# Expect output indicating success | ||
stdout 'License deleted successfully.' | ||
|
||
# Verify the license is deleted | ||
exec relay ls --plain | ||
stdout 'No licenses found.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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 | ||
|
||
# Set a port as environment variable | ||
env PORT=8081 | ||
|
||
# Start the server in the background with the environment variable | ||
exec relay serve --port $PORT &server_process& | ||
|
||
# Wait for the server to start | ||
exec sleep 1 | ||
|
||
# Claim a license using the port from the environment variable | ||
exec curl -s -X PUT http://localhost:$PORT/v1/nodes/test_fingerprint | ||
|
||
# Expect license data in the response | ||
stdout '"license_file":' | ||
|
||
# Release the license | ||
exec curl -s -X DELETE http://localhost:$PORT/v1/nodes/test_fingerprint | ||
|
||
# Expect no content in the response | ||
stdout '' | ||
|
||
# Stop the server | ||
kill server_process | ||
|
||
# Wait for the server to terminate | ||
# wait server_process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 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 | ||
|
||
# Get statistics of the license | ||
exec relay stat --id dcea31a4-1664-4633-9f52-4a1b0b5ea2ef --plain | ||
|
||
# Expect output containing the license details | ||
stdout 'dcea31a4-1664-4633-9f52-4a1b0b5ea2ef' |
Oops, something went wrong.