1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
3 meta.maintainers = [ lib.maintainers.anthonyroussel ];
8 tls-cert = pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
9 openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 \
11 install -D -t $out key.pem cert.pem
14 services.gns3-server = {
19 passwordFile = pkgs.writeText "gns3-auth-password-file" "password";
23 certFile = "${tls-cert}/cert.pem";
24 keyFile = "${tls-cert}/key.pem";
26 dynamips.enable = true;
27 ubridge.enable = true;
31 security.pki.certificateFiles = [ "${tls-cert}/cert.pem" ];
35 createProject = pkgs.writeText "createProject.json" (builtins.toJSON {
36 name = "test_project";
42 machine.wait_for_unit("gns3-server.service")
43 machine.wait_for_open_port(3080)
45 with subtest("server is listening"):
46 machine.succeed("curl -sSfL -u user:password https://localhost:3080/v2/version")
48 with subtest("create dummy project"):
49 machine.succeed("curl -sSfL -u user:password https://localhost:3080/v2/projects -d @${createProject}")
51 with subtest("logging works"):
52 log_path = "/var/log/gns3/server.log"
53 machine.wait_for_file(log_path)