From ffbaf47a7284c485d44c0a5ff8245eeb9521d39f Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Wed, 9 Jul 2025 12:37:43 +0800 Subject: [PATCH 1/2] nixosTests.go-camo: handleTest -> runTest --- nixos/tests/all-tests.nix | 2 +- nixos/tests/go-camo.nix | 52 ++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 4fd1c64693ac..a6c84fe08ba6 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -605,7 +605,7 @@ in gns3-server = runTest ./gns3-server.nix; gnupg = runTest ./gnupg.nix; goatcounter = runTest ./goatcounter.nix; - go-camo = handleTest ./go-camo.nix { }; + go-camo = runTest ./go-camo.nix; go-neb = runTest ./go-neb.nix; gobgpd = runTest ./gobgpd.nix; gocd-agent = runTest ./gocd-agent.nix; diff --git a/nixos/tests/go-camo.nix b/nixos/tests/go-camo.nix index f53d5417ce74..d68bbde537b5 100644 --- a/nixos/tests/go-camo.nix +++ b/nixos/tests/go-camo.nix @@ -1,36 +1,26 @@ +{ lib, ... }: +let + key_val = "12345678"; +in { - system ? builtins.currentSystem, - config ? { }, - pkgs ? import ../.. { inherit system config; }, -}: + name = "go-camo-file-key"; + meta = { + maintainers = [ lib.maintainers.viraptor ]; + }; -with import ../lib/testing-python.nix { inherit system pkgs; }; - -{ - gocamo_file_key = - let - key_val = "12345678"; - in - makeTest { - name = "go-camo-file-key"; - meta = { - maintainers = [ pkgs.lib.maintainers.viraptor ]; + nodes.machine = + { pkgs, ... }: + { + services.go-camo = { + enable = true; + keyFile = pkgs.writeText "foo" key_val; }; - - nodes.machine = - { config, pkgs, ... }: - { - services.go-camo = { - enable = true; - keyFile = pkgs.writeText "foo" key_val; - }; - }; - - # go-camo responds to http requests - testScript = '' - machine.wait_for_unit("go-camo.service") - machine.wait_for_open_port(8080) - machine.succeed("curl http://localhost:8080") - ''; }; + + # go-camo responds to http requests + testScript = '' + machine.wait_for_unit("go-camo.service") + machine.wait_for_open_port(8080) + machine.succeed("curl http://localhost:8080") + ''; } From d0f4edd7806fa418fec1622051df81a283a990dd Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Wed, 9 Jul 2025 22:13:38 +0800 Subject: [PATCH 2/2] go-camo: link nixos test --- pkgs/by-name/go/go-camo/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/go/go-camo/package.nix b/pkgs/by-name/go/go-camo/package.nix index e32a442178df..6ae59c258fa1 100644 --- a/pkgs/by-name/go/go-camo/package.nix +++ b/pkgs/by-name/go/go-camo/package.nix @@ -3,6 +3,7 @@ buildGo124Module, fetchFromGitHub, installShellFiles, + nixosTests, scdoc, }: @@ -43,6 +44,10 @@ buildGo124Module rec { rm pkg/camo/proxy_{,filter_}test.go ''; + passthru.tests = { + inherit (nixosTests) go-camo; + }; + meta = { description = "Camo server is a special type of image proxy that proxies non-secure images over SSL/TLS"; homepage = "https://github.com/cactus/go-camo";