From 620470ea7a1d5723b01005c0d822f6033aa2fa81 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Fri, 21 Jul 2023 01:09:58 -0700 Subject: [PATCH 1/1] Reduce repetition in test script --- checks/mount-grep.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/checks/mount-grep.nix b/checks/mount-grep.nix index 33478ea..f7eb3a3 100644 --- a/checks/mount-grep.nix +++ b/checks/mount-grep.nix @@ -18,16 +18,14 @@ pkgs: { testScript = '' start_all() - shared.wait_for_unit("multi-user.target") - private.wait_for_unit("multi-user.target") - useNixStoreImage.wait_for_unit("multi-user.target") + for machine in [shared, private, useNixStoreImage]: + machine.wait_for_unit("multi-user.target") shared.succeed("[[ $(mount | grep -c virt) -gt 0 ]]") - private.succeed("[[ $(mount | grep -c virt) -eq 0 ]]") - useNixStoreImage.succeed("[[ $(mount | grep -c virt) -eq 0 ]]") - shared.succeed("[[ -e ${pkgs.pv} ]]") - private.fail("[[ -e ${pkgs.pv} ]]") - useNixStoreImage.fail("[[ -e ${pkgs.pv} ]]") + + for machine in [private, useNixStoreImage]: + machine.succeed("[[ $(mount | grep -c virt) -eq 0 ]]") + machine.fail("[[ -e ${pkgs.pv} ]]") ''; } -- 2.44.1