mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixos/homer: add tests
This commit is contained in:
parent
4cff6cd191
commit
e1b59f78a9
5 changed files with 74 additions and 1 deletions
|
@ -436,6 +436,7 @@ in {
|
|||
hedgedoc = handleTest ./hedgedoc.nix {};
|
||||
herbstluftwm = handleTest ./herbstluftwm.nix {};
|
||||
homebox = handleTest ./homebox.nix {};
|
||||
homer = handleTest ./homer {};
|
||||
homepage-dashboard = handleTest ./homepage-dashboard.nix {};
|
||||
honk = runTest ./honk.nix;
|
||||
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
|
||||
|
|
30
nixos/tests/homer/caddy.nix
Normal file
30
nixos/tests/homer/caddy.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
import ../make-test-python.nix (
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
name = "homer-caddy";
|
||||
meta.maintainers = with lib.maintainers; [ stunkymonkey ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.homer = {
|
||||
enable = true;
|
||||
virtualHost = {
|
||||
caddy.enable = true;
|
||||
domain = "localhost:80";
|
||||
};
|
||||
settings = {
|
||||
title = "testing";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("caddy.service")
|
||||
machine.wait_for_open_port(80)
|
||||
machine.succeed("curl --fail --show-error --silent http://localhost:80/ | grep '<title>Homer</title>'")
|
||||
machine.succeed("curl --fail --show-error --silent http://localhost:80/assets/config.yml | grep 'title: testing'")
|
||||
'';
|
||||
}
|
||||
)
|
6
nixos/tests/homer/default.nix
Normal file
6
nixos/tests/homer/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ system, pkgs, ... }:
|
||||
|
||||
{
|
||||
caddy = import ./caddy.nix { inherit system pkgs; };
|
||||
nginx = import ./nginx.nix { inherit system pkgs; };
|
||||
}
|
30
nixos/tests/homer/nginx.nix
Normal file
30
nixos/tests/homer/nginx.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
import ../make-test-python.nix (
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
name = "homer-nginx";
|
||||
meta.maintainers = with lib.maintainers; [ stunkymonkey ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.homer = {
|
||||
enable = true;
|
||||
virtualHost = {
|
||||
nginx.enable = true;
|
||||
domain = "localhost";
|
||||
};
|
||||
settings = {
|
||||
title = "testing";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("nginx.service")
|
||||
machine.wait_for_open_port(80)
|
||||
machine.succeed("curl --fail --show-error --silent http://localhost:80/ | grep '<title>Homer</title>'")
|
||||
machine.succeed("curl --fail --show-error --silent http://localhost:80/assets/config.yml | grep 'title: testing'")
|
||||
'';
|
||||
}
|
||||
)
|
|
@ -6,6 +6,7 @@
|
|||
nodejs,
|
||||
dart-sass,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "homer";
|
||||
|
@ -54,7 +55,12 @@ stdenvNoCC.mkDerivation rec {
|
|||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
tests = {
|
||||
inherit (nixosTests.homer) caddy nginx;
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A very simple static homepage for your server.";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue