Loading nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -607,6 +607,7 @@ in gnupg = runTest ./gnupg.nix; goatcounter = runTest ./goatcounter.nix; go-camo = runTest ./go-camo.nix; go-httpbin = runTest ./go-httpbin.nix; go-neb = runTest ./go-neb.nix; gobgpd = runTest ./gobgpd.nix; gocd-agent = runTest ./gocd-agent.nix; Loading nixos/tests/go-httpbin.nix 0 → 100644 +38 −0 Original line number Diff line number Diff line { lib, ... }: { name = "go-httpbin"; meta.maintainers = with lib.maintainers; [ defelo ]; nodes.machine = { services.go-httpbin = { enable = true; settings.PORT = 8000; }; }; interactive.nodes.machine = { services.go-httpbin.settings.HOST = "0.0.0.0"; networking.firewall.allowedTCPPorts = [ 8000 ]; virtualisation.forwardPorts = [ { from = "host"; host.port = 8000; guest.port = 8000; } ]; }; testScript = '' import json machine.wait_for_unit("go-httpbin.service") machine.wait_for_open_port(8000) resp = json.loads(machine.succeed("curl localhost:8000/get?foo=bar")) assert resp["args"]["foo"] == ["bar"] assert resp["method"] == "GET" assert resp["origin"] == "127.0.0.1" assert resp["url"] == "http://localhost:8000/get?foo=bar" ''; } pkgs/by-name/go/go-httpbin/package.nix +5 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ lib, buildGoModule, fetchFromGitHub, nixosTests, nix-update-script, }: Loading Loading @@ -35,7 +36,10 @@ buildGoModule (finalAttrs: { runHook postInstallCheck ''; passthru.updateScript = nix-update-script { }; passthru = { tests = { inherit (nixosTests) go-httpbin; }; updateScript = nix-update-script { }; }; meta = { description = "Reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib"; Loading Loading
nixos/tests/all-tests.nix +1 −0 Original line number Diff line number Diff line Loading @@ -607,6 +607,7 @@ in gnupg = runTest ./gnupg.nix; goatcounter = runTest ./goatcounter.nix; go-camo = runTest ./go-camo.nix; go-httpbin = runTest ./go-httpbin.nix; go-neb = runTest ./go-neb.nix; gobgpd = runTest ./gobgpd.nix; gocd-agent = runTest ./gocd-agent.nix; Loading
nixos/tests/go-httpbin.nix 0 → 100644 +38 −0 Original line number Diff line number Diff line { lib, ... }: { name = "go-httpbin"; meta.maintainers = with lib.maintainers; [ defelo ]; nodes.machine = { services.go-httpbin = { enable = true; settings.PORT = 8000; }; }; interactive.nodes.machine = { services.go-httpbin.settings.HOST = "0.0.0.0"; networking.firewall.allowedTCPPorts = [ 8000 ]; virtualisation.forwardPorts = [ { from = "host"; host.port = 8000; guest.port = 8000; } ]; }; testScript = '' import json machine.wait_for_unit("go-httpbin.service") machine.wait_for_open_port(8000) resp = json.loads(machine.succeed("curl localhost:8000/get?foo=bar")) assert resp["args"]["foo"] == ["bar"] assert resp["method"] == "GET" assert resp["origin"] == "127.0.0.1" assert resp["url"] == "http://localhost:8000/get?foo=bar" ''; }
pkgs/by-name/go/go-httpbin/package.nix +5 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ lib, buildGoModule, fetchFromGitHub, nixosTests, nix-update-script, }: Loading Loading @@ -35,7 +36,10 @@ buildGoModule (finalAttrs: { runHook postInstallCheck ''; passthru.updateScript = nix-update-script { }; passthru = { tests = { inherit (nixosTests) go-httpbin; }; updateScript = nix-update-script { }; }; meta = { description = "Reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib"; Loading