git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/agate: add nixos test
commit354b24078289c9948f596f7ce2f4ad465ac20635 author06kellyjac <dev@j-k.io> dateMon 7 Feb 2022, 16:03 (5 years ago) parent0a6d22c
3 files changed+33−1
nixos/tests/all-tests.nix+1 nixos/tests/web-servers/agate.nix+29 pkgs/servers/gemini/agate/default.nix+3−1
nixos/tests/all-tests.nix+1
@@ -32,6 +32,7 @@ in
3232 acme = handleTest ./acme.nix {};
3333 adguardhome = handleTest ./adguardhome.nix {};
3434 aesmd = handleTest ./aesmd.nix {};
35+ agate = handleTest ./web-servers/agate.nix {};
3536 agda = handleTest ./agda.nix {};
3637 airsonic = handleTest ./airsonic.nix {};
3738 amazon-init-shell = handleTest ./amazon-init-shell.nix {};
nixos/tests/web-servers/agate.nixnew file+29
@@ -0,0 +1,29 @@
1+import ../make-test-python.nix (
2+ { pkgs, lib, ... }:
3+ {
4+ name = "agate";
5+ meta = with lib.maintainers; { maintainers = [ jk ]; };
6+
7+ nodes = {
8+ geminiserver = { pkgs, ... }: {
9+ services.agate = {
10+ enable = true;
11+ hostnames = [ "localhost" ];
12+ contentDir = pkgs.writeTextDir "index.gmi" ''
13+ # Hello NixOS!
14+ '';
15+ };
16+ };
17+ };
18+
19+ testScript = { nodes, ... }: ''
20+ geminiserver.wait_for_unit("agate")
21+ geminiserver.wait_for_open_port(1965)
22+
23+ with subtest("check is serving over gemini"):
24+ response = geminiserver.succeed("${pkgs.gmni}/bin/gmni -j once -i -N gemini://localhost:1965")
25+ print(response)
26+ assert "Hello NixOS!" in response
27+ '';
28+ }
29+)
pkgs/servers/gemini/agate/default.nix+3−1
@@ -1,4 +1,4 @@
1−{ lib, stdenv, fetchFromGitHub, rustPlatform, libiconv, Security }:
1+{ lib, stdenv, nixosTests, fetchFromGitHub, rustPlatform, libiconv, Security }:
22
33rustPlatform.buildRustPackage rec {
44 pname = "agate";
@@ -23,6 +23,8 @@ rustPlatform.buildRustPackage rec {
2323 runHook postInstallCheck
2424 '';
2525
26+ passthru.tests = { inherit (nixosTests) agate; };
27+
2628 meta = with lib; {
2729 homepage = "https://github.com/mbrubeck/agate";
2830 changelog = "https://github.com/mbrubeck/agate/blob/master/CHANGELOG.md";