chore: Refactor tests

This commit is contained in:
sinavir 2024-07-17 18:32:23 +02:00
parent a97ead90c3
commit ba0ec05e2b
3 changed files with 15 additions and 3 deletions

View file

@ -7,7 +7,10 @@ pkgs.testers.runNixOSTest (_: {
nodes.machine = nodes.machine =
{ config, ... }: { config, ... }:
{ {
imports = [ ../modules ]; imports = [
./common
../modules
];
system.extraDependencies = [ hello ]; system.extraDependencies = [ hello ];
@ -22,7 +25,7 @@ pkgs.testers.runNixOSTest (_: {
services.nginx = { services.nginx = {
enable = true; enable = true;
recommendedProxySettings = true; recommendedProxySettings = true;
virtualHosts.cachix = { virtualHosts.cache = {
default = true; default = true;
locations = { locations = {
"/one".return = "302 /one/"; "/one".return = "302 /one/";
@ -52,7 +55,7 @@ pkgs.testers.runNixOSTest (_: {
if out != "nar-bridge": if out != "nar-bridge":
sys.exit(1) sys.exit(1)
with subtest("Nar upload"): with subtest("Nar upload"):
machine.succeed("nix copy --extra-experimental-features nix-command --to 'http://127.0.0.1/one/?compression=none' ${hello}") machine.succeed("nix copy --to 'http://127.0.0.1/one/?compression=none' ${hello}")
with subtest("narinfo retrieve"): with subtest("narinfo retrieve"):
narHash = "${hello}"[11:11+32] narHash = "${hello}"[11:11+32]
machine.succeed(f"curl -f 'http://127.0.0.1/one/{narHash}.narinfo'") machine.succeed(f"curl -f 'http://127.0.0.1/one/{narHash}.narinfo'")

1
tests/common/default.nix Normal file
View file

@ -0,0 +1 @@
{ imports = [ ./nix.nix ]; }

8
tests/common/nix.nix Normal file
View file

@ -0,0 +1,8 @@
{
nix.settings = {
extra-experimental-features = [
"nix-command"
"flakes"
];
};
}