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