at 24.11-pre 1.5 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: { 2 name = "goss"; 3 meta.maintainers = [ lib.maintainers.anthonyroussel ]; 4 5 nodes.machine = { 6 environment.systemPackages = [ pkgs.jq ]; 7 8 services.goss = { 9 enable = true; 10 11 environment = { 12 GOSS_FMT = "json"; 13 }; 14 15 settings = { 16 addr."tcp://localhost:8080" = { 17 reachable = true; 18 local-address = "127.0.0.1"; 19 }; 20 command."check-goss-version" = { 21 exec = "${lib.getExe pkgs.goss} --version"; 22 exit-status = 0; 23 }; 24 dns.localhost.resolvable = true; 25 file."/nix" = { 26 filetype = "directory"; 27 exists = true; 28 }; 29 group.root.exists = true; 30 kernel-param."kernel.ostype".value = "Linux"; 31 user.root.exists = true; 32 }; 33 }; 34 }; 35 36 testScript = '' 37 import json 38 39 machine.wait_for_unit("goss.service") 40 machine.wait_for_open_port(8080) 41 42 with subtest("returns health status"): 43 result = json.loads(machine.succeed("curl -sS http://localhost:8080/healthz")) 44 45 assert len(result["results"]) == 8, f".results should be an array of 10 items, was {result['results']!r}" 46 assert result["summary"]["failed-count"] == 0, f".summary.failed-count should be zero, was {result['summary']['failed-count']}" 47 assert result["summary"]["test-count"] == 8, f".summary.test-count should be 10, was {result['summary']['test-count']}" 48 ''; 49})