Commit 6bfa191e authored by OPNA2608's avatar OPNA2608
Browse files

nixosTests.galene: Modernise / simplify test code

- makeTest -> passed-through runTest
- Drop hardcoded sleep & check if galene still runs, it's not really necessary
parent 44661754
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -546,7 +546,7 @@ in
  ft2-clone = runTest ./ft2-clone.nix;
  legit = runTest ./legit.nix;
  mimir = runTest ./mimir.nix;
  galene = discoverTests (import ./galene.nix);
  galene = discoverTests (import ./galene.nix { inherit runTest; });
  gancio = runTest ./gancio.nix;
  garage_1 = import ./garage {
    inherit runTest;
+8 −16
Original line number Diff line number Diff line
{ runTest }:

let
  makeTest = import ./make-test-python.nix;
  galeneTestGroupsDir = "/var/lib/galene/groups";
  galeneTestGroupFile = "galene-test-config.json";
  galenePort = 8443;
@@ -7,7 +8,7 @@ let
  galeneTestGroupAdminPassword = "1234";
in
{
  basic = makeTest (
  basic = runTest (
    { pkgs, lib, ... }:
    {
      name = "galene-works";
@@ -56,10 +57,7 @@ in
        with subtest("galene starts"):
            # Starts?
            machine.wait_for_unit("galene")

            # Keeps running after startup?
            machine.sleep(10)
            machine.wait_for_unit("galene")
            machine.wait_for_open_port(${builtins.toString galenePort})

            # Reponds fine?
            machine.succeed("curl -s -D - -o /dev/null 'http://localhost:${builtins.toString galenePort}' >&2")
@@ -93,7 +91,7 @@ in
    }
  );

  file-transfer = makeTest (
  file-transfer = runTest (
    { pkgs, lib, ... }:
    {
      name = "galene-file-transfer-works";
@@ -143,10 +141,7 @@ in
        with subtest("galene starts"):
            # Starts?
            machine.wait_for_unit("galene")

            # Keeps running after startup?
            machine.sleep(10)
            machine.wait_for_unit("galene")
            machine.wait_for_open_port(${builtins.toString galenePort})

            # Reponds fine?
            machine.succeed("curl -s -D - -o /dev/null 'http://localhost:${builtins.toString galenePort}' >&2")
@@ -209,7 +204,7 @@ in
    }
  );

  stream = makeTest (
  stream = runTest (
    { pkgs, lib, ... }:
    let
      galeneTestGroupBotName = "bot";
@@ -281,10 +276,7 @@ in
        with subtest("galene starts"):
            # Starts?
            machine.wait_for_unit("galene")

            # Keeps running after startup?
            machine.sleep(10)
            machine.wait_for_unit("galene")
            machine.wait_for_open_port(${builtins.toString galenePort})

            # Reponds fine?
            machine.succeed("curl -s -D - -o /dev/null 'http://localhost:${builtins.toString galenePort}' >&2")