Skip to content

Commit

Permalink
nixos/octoprint: add tests for reachability over IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDaG committed Nov 3, 2024
1 parent 933914d commit 2599d2e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions nixos/tests/octoprint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ in
# used to fail early, in case octoprint first starts and then crashes
with octoprint_running: # type: ignore[union-attr]
with subtest("Check for web interface"):
machine.wait_until_succeeds("curl -s localhost:5000")
machine.wait_until_succeeds("curl -s -4 localhost:5000")
machine.wait_until_succeeds("curl -s -6 localhost:5000")
with subtest("Check API"):
version = json.loads(machine.succeed(curl_cmd + "localhost:5000/api/version"))
server = json.loads(machine.succeed(curl_cmd + "localhost:5000/api/server"))
with subtest("Check API IPv4"):
version = json.loads(machine.succeed(curl_cmd + "-4 localhost:5000/api/version"))
server = json.loads(machine.succeed(curl_cmd + "-4 localhost:5000/api/server"))
assert version["server"] == str("${pkgs.octoprint.version}")
assert server["safemode"] == None
with subtest("Check API IPv6"):
version = json.loads(machine.succeed(curl_cmd + "-6 localhost:5000/api/version"))
server = json.loads(machine.succeed(curl_cmd + "-6 localhost:5000/api/server"))
assert version["server"] == str("${pkgs.octoprint.version}")
assert server["safemode"] == None
'';
Expand Down

0 comments on commit 2599d2e

Please sign in to comment.