about summary refs log tree commit diff
path: root/pkgs/applications/networking/gns3
diff options
context:
space:
mode:
authorAnthony Roussel <anthony@roussel.dev>2023-09-20 22:37:59 +0200
committerAnthony Roussel <anthony@roussel.dev>2023-09-20 23:19:10 +0200
commite206ee4cf3b4fd8b5bf848d115b4a6baa305f632 (patch)
tree2d1a86e7d3f39279ea0d0be8cd6410aff2a2f976 /pkgs/applications/networking/gns3
parent1387e36a73873e1f74b2cee267616a2fa37cb28b (diff)
gns3-server,gns3-gui: enable checkPhase
Diffstat (limited to 'pkgs/applications/networking/gns3')
-rw-r--r--pkgs/applications/networking/gns3/gui.nix16
-rw-r--r--pkgs/applications/networking/gns3/server.nix24
2 files changed, 35 insertions, 5 deletions
diff --git a/pkgs/applications/networking/gns3/gui.nix b/pkgs/applications/networking/gns3/gui.nix
index 57228d1a97f61..a9537d9931711 100644
--- a/pkgs/applications/networking/gns3/gui.nix
+++ b/pkgs/applications/networking/gns3/gui.nix
@@ -6,6 +6,7 @@
 { lib
 , python3
 , fetchFromGitHub
+, qt5
 , wrapQtAppsHook
 }:
 
@@ -36,14 +37,25 @@ python3.pkgs.buildPythonApplication rec {
     importlib-resources
   ];
 
-  doCheck = false; # Failing
-
   dontWrapQtApps = true;
 
   preFixup = ''
     wrapQtApp "$out/bin/gns3"
   '';
 
+  doCheck = true;
+
+  checkInputs = with python3.pkgs; [
+    pytestCheckHook
+  ];
+
+  preCheck = ''
+    export HOME=$(mktemp -d)
+    export QT_PLUGIN_PATH="${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}"
+    export QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins";
+    export QT_QPA_PLATFORM=offscreen
+  '';
+
   meta = with lib; {
     description = "Graphical Network Simulator 3 GUI (${channel} release)";
     longDescription = ''
diff --git a/pkgs/applications/networking/gns3/server.nix b/pkgs/applications/networking/gns3/server.nix
index f8d8d7381ec5c..98ae803492f0f 100644
--- a/pkgs/applications/networking/gns3/server.nix
+++ b/pkgs/applications/networking/gns3/server.nix
@@ -46,13 +46,31 @@ python3.pkgs.buildPythonApplication {
     zipstream
   ];
 
-  # Requires network access
-  doCheck = false;
-
   postInstall = ''
     rm $out/bin/gns3loopback # For Windows only
   '';
 
+  doCheck = true;
+
+  # Otherwise tests will fail to create directory
+  # Permission denied: '/homeless-shelter'
+  preCheck = ''
+    export HOME=$(mktemp -d)
+  '';
+
+  checkInputs = with python3.pkgs; [
+    pytest-aiohttp
+    pytest-rerunfailures
+    pytestCheckHook
+  ];
+
+  pytestFlagsArray = [
+    # fails on ofborg because of lack of cpu vendor information
+    "--deselect=tests/controller/gns3vm/test_virtualbox_gns3_vm.py::test_cpu_vendor_id"
+    # Rerun failed tests up to three times (flaky tests)
+    "--reruns 3"
+  ];
+
   meta = with lib; {
     description = "Graphical Network Simulator 3 server (${channel} release)";
     longDescription = ''