mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
nixos/tests/anubis: add testing for user-defined settings
This commit is contained in:
parent
b2714cd757
commit
5a0db60d73
1 changed files with 42 additions and 17 deletions
|
@ -1,7 +1,10 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
name = "anubis";
|
name = "anubis";
|
||||||
meta.maintainers = [ lib.maintainers.soopyc ];
|
meta.maintainers = with lib.maintainers; [
|
||||||
|
soopyc
|
||||||
|
nullcube
|
||||||
|
];
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{
|
{
|
||||||
|
@ -10,8 +13,17 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
services.anubis.instances = {
|
services.anubis = {
|
||||||
"".settings.TARGET = "http://localhost:8080";
|
defaultOptions.settings = {
|
||||||
|
DIFFICULTY = 3;
|
||||||
|
USER_DEFINED_DEFAULT = true;
|
||||||
|
};
|
||||||
|
instances = {
|
||||||
|
"".settings = {
|
||||||
|
TARGET = "http://localhost:8080";
|
||||||
|
DIFFICULTY = 5;
|
||||||
|
USER_DEFINED_INSTANCE = true;
|
||||||
|
};
|
||||||
|
|
||||||
"tcp" = {
|
"tcp" = {
|
||||||
user = "anubis-tcp";
|
user = "anubis-tcp";
|
||||||
|
@ -30,6 +42,7 @@
|
||||||
settings.TARGET = "unix:///run/nginx/nginx.sock";
|
settings.TARGET = "unix:///run/nginx/nginx.sock";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# support
|
# support
|
||||||
users.users.nginx.extraGroups = [ config.users.groups.anubis.name ];
|
users.users.nginx.extraGroups = [ config.users.groups.anubis.name ];
|
||||||
|
@ -94,5 +107,17 @@
|
||||||
|
|
||||||
# Upstream is a unix socket mode
|
# Upstream is a unix socket mode
|
||||||
machine.succeed('curl -f http://unix.localhost/index.html | grep "it works"')
|
machine.succeed('curl -f http://unix.localhost/index.html | grep "it works"')
|
||||||
|
|
||||||
|
# Default user-defined environment variables
|
||||||
|
machine.succeed('cat /run/current-system/etc/systemd/system/anubis.service | grep "USER_DEFINED_DEFAULT"')
|
||||||
|
machine.succeed('cat /run/current-system/etc/systemd/system/anubis-tcp.service | grep "USER_DEFINED_DEFAULT"')
|
||||||
|
|
||||||
|
# Instance-specific user-specified environment variables
|
||||||
|
machine.succeed('cat /run/current-system/etc/systemd/system/anubis.service | grep "USER_DEFINED_INSTANCE"')
|
||||||
|
machine.fail('cat /run/current-system/etc/systemd/system/anubis-tcp.service | grep "USER_DEFINED_INSTANCE"')
|
||||||
|
|
||||||
|
# Make sure defaults don't overwrite themselves
|
||||||
|
machine.succeed('cat /run/current-system/etc/systemd/system/anubis.service | grep "DIFFICULTY=5"')
|
||||||
|
machine.succeed('cat /run/current-system/etc/systemd/system/anubis-tcp.service | grep "DIFFICULTY=3"')
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue