mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
nixosTests.gns3-server: init
This commit is contained in:
parent
0db5959bd7
commit
7cfb941775
|
@ -338,6 +338,7 @@ in {
|
|||
gnome-extensions = handleTest ./gnome-extensions.nix {};
|
||||
gnome-flashback = handleTest ./gnome-flashback.nix {};
|
||||
gnome-xorg = handleTest ./gnome-xorg.nix {};
|
||||
gns3-server = handleTest ./gns3-server.nix {};
|
||||
gnupg = handleTest ./gnupg.nix {};
|
||||
go-neb = handleTest ./go-neb.nix {};
|
||||
gobgpd = handleTest ./gobgpd.nix {};
|
||||
|
|
55
nixos/tests/gns3-server.nix
Normal file
55
nixos/tests/gns3-server.nix
Normal file
|
@ -0,0 +1,55 @@
|
|||
import ./make-test-python.nix ({ pkgs, lib, ... }: {
|
||||
name = "gns3-server";
|
||||
meta.maintainers = [ lib.maintainers.anthonyroussel ];
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
let
|
||||
tls-cert = pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -days 365 \
|
||||
-subj '/CN=localhost'
|
||||
install -D -t $out key.pem cert.pem
|
||||
'';
|
||||
in {
|
||||
services.gns3-server = {
|
||||
enable = true;
|
||||
auth = {
|
||||
enable = true;
|
||||
user = "user";
|
||||
passwordFile = pkgs.writeText "gns3-auth-password-file" "password";
|
||||
};
|
||||
ssl = {
|
||||
enable = true;
|
||||
certFile = "${tls-cert}/cert.pem";
|
||||
keyFile = "${tls-cert}/key.pem";
|
||||
};
|
||||
dynamips.enable = true;
|
||||
ubridge.enable = true;
|
||||
vpcs.enable = true;
|
||||
};
|
||||
|
||||
security.pki.certificateFiles = [ "${tls-cert}/cert.pem" ];
|
||||
};
|
||||
|
||||
testScript = let
|
||||
createProject = pkgs.writeText "createProject.json" (builtins.toJSON {
|
||||
name = "test_project";
|
||||
});
|
||||
in
|
||||
''
|
||||
start_all()
|
||||
|
||||
machine.wait_for_unit("gns3-server.service")
|
||||
machine.wait_for_open_port(3080)
|
||||
|
||||
with subtest("server is listening"):
|
||||
machine.succeed("curl -sSfL -u user:password https://localhost:3080/v2/version")
|
||||
|
||||
with subtest("create dummy project"):
|
||||
machine.succeed("curl -sSfL -u user:password https://localhost:3080/v2/projects -d @${createProject}")
|
||||
|
||||
with subtest("logging works"):
|
||||
log_path = "/var/log/gns3/server.log"
|
||||
machine.wait_for_file(log_path)
|
||||
'';
|
||||
})
|
|
@ -8,6 +8,7 @@
|
|||
, fetchFromGitHub
|
||||
, pkgsStatic
|
||||
, stdenv
|
||||
, nixosTests
|
||||
, testers
|
||||
, gns3-server
|
||||
}:
|
||||
|
@ -75,9 +76,12 @@ python3.pkgs.buildPythonApplication {
|
|||
"--reruns 3"
|
||||
];
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = gns3-server;
|
||||
command = "${lib.getExe gns3-server} --version";
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) gns3-server;
|
||||
version = testers.testVersion {
|
||||
package = gns3-server;
|
||||
command = "${lib.getExe gns3-server} --version";
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
|
Loading…
Reference in a new issue