parent
0159ddabe6
commit
efee1fc5cc
@ -1233,7 +1233,7 @@ in
|
|||||||
stargazer = runTest ./web-servers/stargazer.nix;
|
stargazer = runTest ./web-servers/stargazer.nix;
|
||||||
starship = runTest ./starship.nix;
|
starship = runTest ./starship.nix;
|
||||||
stash = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./stash.nix { };
|
stash = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./stash.nix { };
|
||||||
static-web-server = handleTest ./web-servers/static-web-server.nix { };
|
static-web-server = runTest ./web-servers/static-web-server.nix;
|
||||||
step-ca = handleTestOn [ "x86_64-linux" ] ./step-ca.nix { };
|
step-ca = handleTestOn [ "x86_64-linux" ] ./step-ca.nix { };
|
||||||
stratis = handleTest ./stratis { };
|
stratis = handleTest ./stratis { };
|
||||||
strongswan-swanctl = handleTest ./strongswan-swanctl.nix { };
|
strongswan-swanctl = handleTest ./strongswan-swanctl.nix { };
|
||||||
|
|||||||
@ -1,41 +1,39 @@
|
|||||||
import ../make-test-python.nix (
|
{ pkgs, lib, ... }:
|
||||||
{ pkgs, lib, ... }:
|
{
|
||||||
{
|
name = "static-web-server";
|
||||||
name = "static-web-server";
|
meta = {
|
||||||
meta = {
|
maintainers = with lib.maintainers; [ mac-chaffee ];
|
||||||
maintainers = with lib.maintainers; [ mac-chaffee ];
|
};
|
||||||
};
|
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
services.static-web-server = {
|
services.static-web-server = {
|
||||||
enable = true;
|
enable = true;
|
||||||
listen = "[::]:8080";
|
listen = "[::]:8080";
|
||||||
root = toString (
|
root = toString (
|
||||||
pkgs.writeTextDir "nixos-test.html" ''
|
pkgs.writeTextDir "nixos-test.html" ''
|
||||||
<h1>Hello NixOS!</h1>
|
<h1>Hello NixOS!</h1>
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
configuration = {
|
configuration = {
|
||||||
general = {
|
general = {
|
||||||
directory-listing = true;
|
directory-listing = true;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
machine.start()
|
machine.start()
|
||||||
machine.wait_for_unit("static-web-server.socket")
|
machine.wait_for_unit("static-web-server.socket")
|
||||||
machine.wait_for_open_port(8080)
|
machine.wait_for_open_port(8080)
|
||||||
# We don't use wait_until_succeeds() because we're testing socket
|
# We don't use wait_until_succeeds() because we're testing socket
|
||||||
# activation which better work on the first request
|
# activation which better work on the first request
|
||||||
response = machine.succeed("curl -fsS localhost:8080")
|
response = machine.succeed("curl -fsS localhost:8080")
|
||||||
assert "nixos-test.html" in response, "The directory listing page did not include a link to our nixos-test.html file"
|
assert "nixos-test.html" in response, "The directory listing page did not include a link to our nixos-test.html file"
|
||||||
response = machine.succeed("curl -fsS localhost:8080/nixos-test.html")
|
response = machine.succeed("curl -fsS localhost:8080/nixos-test.html")
|
||||||
assert "Hello NixOS!" in response
|
assert "Hello NixOS!" in response
|
||||||
machine.wait_for_unit("static-web-server.service")
|
machine.wait_for_unit("static-web-server.service")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user