From 56c4e8b5b5754d96cfd81b858fd6abc9eb19c484 Mon Sep 17 00:00:00 2001 From: eljamm Date: Tue, 20 May 2025 21:03:22 +0200 Subject: [PATCH] nixos/test: init omnom --- nixos/tests/all-tests.nix | 1 + nixos/tests/omnom.nix | 42 +++++++++++++++++++++++++++++++ pkgs/by-name/om/omnom/package.nix | 3 +++ 3 files changed, 46 insertions(+) create mode 100644 nixos/tests/omnom.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index c6926aaeb901..2ef61d4f5784 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1008,6 +1008,7 @@ in ollama-cuda = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-cuda.nix; ollama-rocm = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./ollama-rocm.nix; ombi = runTest ./ombi.nix; + omnom = runTest ./omnom.nix; openarena = runTest ./openarena.nix; openbao = runTest ./openbao.nix; opencloud = runTest ./opencloud.nix; diff --git a/nixos/tests/omnom.nix b/nixos/tests/omnom.nix new file mode 100644 index 000000000000..4bfdbd679b39 --- /dev/null +++ b/nixos/tests/omnom.nix @@ -0,0 +1,42 @@ +{ lib, ... }: +let + servicePort = 9090; +in +{ + name = "Basic Omnom Test"; + meta = { + maintainers = lib.teams.ngi.members; + }; + + nodes = { + server = + { config, lib, ... }: + { + services.omnom = { + enable = true; + openFirewall = true; + + port = servicePort; + + settings = { + app = { + disable_signup = false; # restrict CLI user-creation + results_per_page = 50; + }; + server.address = "0.0.0.0:${toString servicePort}"; + }; + }; + }; + }; + + # TODO: take a snapshot + testScript = + { nodes, ... }: + # python + '' + server.start() + server.wait_for_unit("omnom.service") + server.wait_for_open_port(${toString servicePort}) + server.succeed("curl -sf http://localhost:${toString servicePort}") + ''; +} diff --git a/pkgs/by-name/om/omnom/package.nix b/pkgs/by-name/om/omnom/package.nix index 9e4076306615..8290041561d7 100644 --- a/pkgs/by-name/om/omnom/package.nix +++ b/pkgs/by-name/om/omnom/package.nix @@ -4,6 +4,7 @@ fetchFromGitHub, nix-update-script, makeWrapper, + nixosTests, # for addons buildNpmPackage, @@ -77,6 +78,8 @@ buildGoModule (finalAttrs: { cp config.yml_sample $out/share/examples/config.yml ''; + passthru.tests = nixosTests.omnom; + meta = { description = "Webpage bookmarking and snapshotting service"; homepage = "https://github.com/asciimoo/omnom";