From 92d438cec90b6fab400335306ab38b72780a76f5 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Fri, 4 Apr 2025 20:49:57 +0200 Subject: [PATCH] nixosTests.moodle: migrate to runTest Part of #386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/moodle.nix | 44 +++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 132bd5d64d22..dda3a6df7667 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -795,7 +795,7 @@ in defaults.services.mongodb.package = config.node.pkgs.mongodb-ce; } ); - moodle = handleTest ./moodle.nix { }; + moodle = runTest ./moodle.nix; moonraker = handleTest ./moonraker.nix { }; mopidy = handleTest ./mopidy.nix { }; morph-browser = runTest ./morph-browser.nix; diff --git a/nixos/tests/moodle.nix b/nixos/tests/moodle.nix index 4bf1c5e6c702..f3eee04b0d62 100644 --- a/nixos/tests/moodle.nix +++ b/nixos/tests/moodle.nix @@ -1,26 +1,24 @@ -import ./make-test-python.nix ( - { pkgs, lib, ... }: - { - name = "moodle"; - meta.maintainers = [ lib.maintainers.aanderse ]; +{ lib, ... }: +{ + name = "moodle"; + meta.maintainers = [ lib.maintainers.aanderse ]; - nodes.machine = - { ... }: - { - services.moodle.enable = true; - services.moodle.virtualHost.hostName = "localhost"; - services.moodle.virtualHost.adminAddr = "root@example.com"; - services.moodle.initialPassword = "correcthorsebatterystaple"; + nodes.machine = + { ... }: + { + services.moodle.enable = true; + services.moodle.virtualHost.hostName = "localhost"; + services.moodle.virtualHost.adminAddr = "root@example.com"; + services.moodle.initialPassword = "correcthorsebatterystaple"; - # Ensure the virtual machine has enough memory to avoid errors like: - # Fatal error: Out of memory (allocated 152047616) (tried to allocate 33554440 bytes) - virtualisation.memorySize = 2000; - }; + # Ensure the virtual machine has enough memory to avoid errors like: + # Fatal error: Out of memory (allocated 152047616) (tried to allocate 33554440 bytes) + virtualisation.memorySize = 2000; + }; - testScript = '' - start_all() - machine.wait_for_unit("phpfpm-moodle.service", timeout=1800) - machine.wait_until_succeeds("curl http://localhost/ | grep 'You are not logged in'") - ''; - } -) + testScript = '' + start_all() + machine.wait_for_unit("phpfpm-moodle.service", timeout=1800) + machine.wait_until_succeeds("curl http://localhost/ | grep 'You are not logged in'") + ''; +}