nixos/tests/go-httpbin: init

Defelo e1b8c6c4 224dc30d

+44 -1
+1
nixos/tests/all-tests.nix
··· 607 gnupg = runTest ./gnupg.nix; 608 goatcounter = runTest ./goatcounter.nix; 609 go-camo = runTest ./go-camo.nix; 610 go-neb = runTest ./go-neb.nix; 611 gobgpd = runTest ./gobgpd.nix; 612 gocd-agent = runTest ./gocd-agent.nix;
··· 607 gnupg = runTest ./gnupg.nix; 608 goatcounter = runTest ./goatcounter.nix; 609 go-camo = runTest ./go-camo.nix; 610 + go-httpbin = runTest ./go-httpbin.nix; 611 go-neb = runTest ./go-neb.nix; 612 gobgpd = runTest ./gobgpd.nix; 613 gocd-agent = runTest ./gocd-agent.nix;
+38
nixos/tests/go-httpbin.nix
···
··· 1 + { lib, ... }: 2 + 3 + { 4 + name = "go-httpbin"; 5 + meta.maintainers = with lib.maintainers; [ defelo ]; 6 + 7 + nodes.machine = { 8 + services.go-httpbin = { 9 + enable = true; 10 + settings.PORT = 8000; 11 + }; 12 + }; 13 + 14 + interactive.nodes.machine = { 15 + services.go-httpbin.settings.HOST = "0.0.0.0"; 16 + networking.firewall.allowedTCPPorts = [ 8000 ]; 17 + virtualisation.forwardPorts = [ 18 + { 19 + from = "host"; 20 + host.port = 8000; 21 + guest.port = 8000; 22 + } 23 + ]; 24 + }; 25 + 26 + testScript = '' 27 + import json 28 + 29 + machine.wait_for_unit("go-httpbin.service") 30 + machine.wait_for_open_port(8000) 31 + 32 + resp = json.loads(machine.succeed("curl localhost:8000/get?foo=bar")) 33 + assert resp["args"]["foo"] == ["bar"] 34 + assert resp["method"] == "GET" 35 + assert resp["origin"] == "127.0.0.1" 36 + assert resp["url"] == "http://localhost:8000/get?foo=bar" 37 + ''; 38 + }
+5 -1
pkgs/by-name/go/go-httpbin/package.nix
··· 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 nix-update-script, 6 }: 7 ··· 35 runHook postInstallCheck 36 ''; 37 38 - passthru.updateScript = nix-update-script { }; 39 40 meta = { 41 description = "Reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib";
··· 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 + nixosTests, 6 nix-update-script, 7 }: 8 ··· 36 runHook postInstallCheck 37 ''; 38 39 + passthru = { 40 + tests = { inherit (nixosTests) go-httpbin; }; 41 + updateScript = nix-update-script { }; 42 + }; 43 44 meta = { 45 description = "Reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib";