nixos/agate: add nixos test

This commit is contained in:
06kellyjac 2022-02-07 16:03:58 +00:00
parent 0a6d22c6c3
commit 354b240782
3 changed files with 33 additions and 1 deletions

View file

@ -32,6 +32,7 @@ in
acme = handleTest ./acme.nix {};
adguardhome = handleTest ./adguardhome.nix {};
aesmd = handleTest ./aesmd.nix {};
agate = handleTest ./web-servers/agate.nix {};
agda = handleTest ./agda.nix {};
airsonic = handleTest ./airsonic.nix {};
amazon-init-shell = handleTest ./amazon-init-shell.nix {};

View file

@ -0,0 +1,29 @@
import ../make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "agate";
meta = with lib.maintainers; { maintainers = [ jk ]; };
nodes = {
geminiserver = { pkgs, ... }: {
services.agate = {
enable = true;
hostnames = [ "localhost" ];
contentDir = pkgs.writeTextDir "index.gmi" ''
# Hello NixOS!
'';
};
};
};
testScript = { nodes, ... }: ''
geminiserver.wait_for_unit("agate")
geminiserver.wait_for_open_port(1965)
with subtest("check is serving over gemini"):
response = geminiserver.succeed("${pkgs.gmni}/bin/gmni -j once -i -N gemini://localhost:1965")
print(response)
assert "Hello NixOS!" in response
'';
}
)

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, rustPlatform, libiconv, Security }:
{ lib, stdenv, nixosTests, fetchFromGitHub, rustPlatform, libiconv, Security }:
rustPlatform.buildRustPackage rec {
pname = "agate";
@ -23,6 +23,8 @@ rustPlatform.buildRustPackage rec {
runHook postInstallCheck
'';
passthru.tests = { inherit (nixosTests) agate; };
meta = with lib; {
homepage = "https://github.com/mbrubeck/agate";
changelog = "https://github.com/mbrubeck/agate/blob/master/CHANGELOG.md";