aboutsummaryrefslogtreecommitdiffstats
path: root/tests/by-name/ba
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-18 22:35:46 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-18 22:35:46 +0200
commitb84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007 (patch)
tree42b64963341fc7e6251e16c68dfbdb4b3be54aa1 /tests/by-name/ba
parentscripts/update_hosts.sh: Use faster `nix copy` and ping hosts after update (diff)
downloadnixos-server-b84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007.zip
tests: Refactor to unify tests and avoid duplicated code
Diffstat (limited to 'tests/by-name/ba')
-rw-r--r--tests/by-name/ba/back/test.nix45
1 files changed, 14 insertions, 31 deletions
diff --git a/tests/by-name/ba/back/test.nix b/tests/by-name/ba/back/test.nix
index 41d6c8e..d8adedb 100644
--- a/tests/by-name/ba/back/test.nix
+++ b/tests/by-name/ba/back/test.nix
@@ -1,11 +1,7 @@
{
- nixos-lib,
- pkgsUnstable,
- nixpkgs-unstable,
- vhackPackages,
pkgs,
extraModules,
- nixLib,
+ vhack,
...
}: let
domain = "server";
@@ -22,17 +18,14 @@
option user-configs = cgit\.owner cgit\.desc cgit\.section cgit\.homepage
'';
in
- nixos-lib.runTest {
- hostPkgs = pkgs; # the Nixpkgs package set used outside the VMs
-
+ vhack.runTest {
name = "back";
- node = {
- specialArgs = {inherit pkgsUnstable vhackPackages nixpkgs-unstable nixLib;};
- # Use the nixpkgs as constructed by the `nixpkgs.*` options
- pkgs = null;
- };
+ serverDomains = [
+ {server = "git.${domain}";}
+ {server = "issues.${domain}";}
+ ];
nodes = {
server = {config, ...}: {
@@ -49,7 +42,6 @@ in
openssh.enable = true;
nginx = {
enable = true;
- selfsign = true;
};
git-server = {
enable = true;
@@ -73,23 +65,17 @@ in
PreferredAuthentications publickey
'';
users.users.alice = {isNormalUser = true;};
- networking.hosts = {
- "${nodes.server.networking.primaryIPAddress}" = [
- "git.${domain}"
- "issues.${domain}"
- "${domain}"
- ];
- };
};
};
+ services = [
+ {server = "gitolite-init.service";}
+ {server = "sshd.service";}
+ ];
+
testScript = {nodes, ...}:
- /*
- python
- */
+ # Python
''
- start_all()
-
with subtest("can setup ssh keys on client"):
client.succeed(
"mkdir -p ~root/.ssh",
@@ -103,11 +89,8 @@ in
)
with subtest("gitolite server starts"):
- server.wait_for_unit("gitolite-init.service")
- server.wait_for_unit("sshd.service")
client.succeed("ssh -n git@git.${domain} info")
-
with subtest("admin can clone and configure gitolite-admin.git"):
server.succeed("sudo -u git ${pkgs.writeShellScript "delete_main_branch_on_server" ''
set -xe
@@ -188,10 +171,10 @@ in
client.succeed("${pkgs.writeShellScript "curl-back" ''
set -xe
- curl --insecure --fail --show-error "https://issues.${domain}/alice/repo1/issues/?query=status:open" --output /root/issues.html
+ curl --fail --show-error "https://issues.${domain}/alice/repo1/issues/?query=status:open" --output /root/issues.html
grep -- 'Second bug title' /root/issues.html
- curl --insecure --fail --show-error "https://issues.${domain}/" --output /root/repos.html
+ curl --fail --show-error "https://issues.${domain}/" --output /root/repos.html
grep -- 'repo' /root/repos.html
grep -- "&lt;No description&gt;" /root/repos.html
grep -- '<span class="user-name">Alice</span>' /root/repos.html