Skip to content

Commit 65822ea

Browse files
fix: use subtests
1 parent 101a11b commit 65822ea

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

nix/tests.nix

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,22 @@ let
2525
};
2626
in
2727
lib.mapAttrs (name: test: pkgs.testers.runNixOSTest (test // { inherit name defaults; })) {
28-
application-tests = {
29-
nodes.server = _: { imports = [ ./configuration.nix ]; };
30-
# run all application-level tests managed by Django
31-
# https://docs.djangoproject.com/en/5.0/topics/testing/overview/
32-
testScript = ''
33-
server.wait_for_unit("${application}-server.service")
34-
server.succeed("manage test shared")
35-
server.succeed("manage test webview")
36-
'';
37-
};
38-
css = {
39-
nodes.server = _: { imports = [ ./web-security-tracker.nix ]; };
40-
# check that the style sheet is served
41-
testScript = ''
42-
server.wait_for_unit("${application}-server.service")
43-
server.wait_for_open_port(8000)
44-
machine.succeed("curl --fail -H 'Host: example.org' http://127.0.0.1:80/static/style.css")
45-
'';
46-
};
47-
admin = {
28+
basic = {
4829
nodes.server = _: { imports = [ ./web-security-tracker.nix ]; };
49-
# check that the admin interface is served
5030
testScript = ''
5131
server.wait_for_unit("${application}-server.service")
52-
server.wait_for_open_port(8000)
53-
server.succeed("curl --fail -L -H 'Host: example.org' http://localhost/admin")
32+
server.wait_for_unit("${application}-worker.service")
33+
34+
with subtest("Django application tests"):
35+
# https://docs.djangoproject.com/en/5.0/topics/testing/overview/
36+
server.succeed("wst-manage test shared")
37+
server.succeed("wst-manage test webview")
38+
39+
with subtest("Check that stylesheet is served"):
40+
machine.succeed("curl --fail -H 'Host: example.org' http://localhost/static/style.css")
41+
42+
with subtest("Check that admin interface is served"):
43+
server.succeed("curl --fail -L -H 'Host: example.org' http://localhost/admin")
5444
'';
5545
};
5646
}

0 commit comments

Comments
 (0)