From ea7101783c474ba072fa565e3ecc0e5c530ef61b Mon Sep 17 00:00:00 2001 From: Max Niederman Date: Mon, 5 Feb 2024 23:51:17 -0800 Subject: [PATCH] nixos/tests/photonvision: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/photonvision.nix | 21 +++++++++++++++++++++ pkgs/by-name/ph/photonvision/package.nix | 5 +++++ 3 files changed, 27 insertions(+) create mode 100644 nixos/tests/photonvision.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index c2114098fe05..94d4e95bc031 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -679,6 +679,7 @@ in { pgjwt = handleTest ./pgjwt.nix {}; pgmanage = handleTest ./pgmanage.nix {}; phosh = handleTest ./phosh.nix {}; + photonvision = handleTest ./photonvision.nix {}; photoprism = handleTest ./photoprism.nix {}; php = handleTest ./php {}; php81 = handleTest ./php { php = pkgs.php81; }; diff --git a/nixos/tests/photonvision.nix b/nixos/tests/photonvision.nix new file mode 100644 index 000000000000..2cadaa4bc02e --- /dev/null +++ b/nixos/tests/photonvision.nix @@ -0,0 +1,21 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: +{ + name = "photonvision"; + + nodes = { + machine = { pkgs, ... }: { + services.photonvision = { + enable = true; + }; + }; + }; + + testScript = '' + start_all() + machine.wait_for_unit("photonvision.service") + machine.wait_for_open_port(5800) + ''; + + meta.maintainers = with lib.maintainers; [ max-niederman ]; +}) + diff --git a/pkgs/by-name/ph/photonvision/package.nix b/pkgs/by-name/ph/photonvision/package.nix index 6a6f4cc14b18..e36f5393bbbf 100644 --- a/pkgs/by-name/ph/photonvision/package.nix +++ b/pkgs/by-name/ph/photonvision/package.nix @@ -5,6 +5,7 @@ , temurin-jre-bin-11 , bash , suitesparse +, nixosTests }: stdenv.mkDerivation rec { @@ -39,6 +40,10 @@ stdenv.mkDerivation rec { runHook postInstall ''; + passthru.tests = { + starts-web-server = nixosTests.photonvision; + }; + meta = with lib; { description = "The free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition"; homepage = "https://photonvision.org/";