From bd49230ea4640dc22f167777f31195e443c0451a Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski <2151333+piotrkwiecinski@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:23:11 +0200 Subject: [PATCH] nixosTests.samba: migrate to runTest Part of #386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/samba.nix | 84 +++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 8e83095a7ded..d794191df976 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1175,7 +1175,7 @@ in rustls-libssl = handleTest ./rustls-libssl.nix { }; rxe = handleTest ./rxe.nix { }; sabnzbd = handleTest ./sabnzbd.nix { }; - samba = handleTest ./samba.nix { }; + samba = runTest ./samba.nix; samba-wsdd = handleTest ./samba-wsdd.nix { }; sane = handleTest ./sane.nix { }; sanoid = handleTest ./sanoid.nix { }; diff --git a/nixos/tests/samba.nix b/nixos/tests/samba.nix index 96f63730b613..b9f2f1384559 100644 --- a/nixos/tests/samba.nix +++ b/nixos/tests/samba.nix @@ -1,50 +1,48 @@ -import ./make-test-python.nix ( - { pkgs, lib, ... }: - { - name = "samba"; +{ lib, ... }: +{ + name = "samba"; - meta.maintainers = [ lib.maintainers.anthonyroussel ]; + meta.maintainers = [ lib.maintainers.anthonyroussel ]; - nodes = { - client = - { ... }: - { - virtualisation.fileSystems = { - "/public" = { - fsType = "cifs"; - device = "//server/public"; - options = [ "guest" ]; + nodes = { + client = + { ... }: + { + virtualisation.fileSystems = { + "/public" = { + fsType = "cifs"; + device = "//server/public"; + options = [ "guest" ]; + }; + }; + }; + + server = + { ... }: + { + services.samba = { + enable = true; + openFirewall = true; + settings = { + "public" = { + "path" = "/public"; + "read only" = true; + "browseable" = "yes"; + "guest ok" = "yes"; + "comment" = "Public samba share."; }; }; }; + }; + }; - server = - { ... }: - { - services.samba = { - enable = true; - openFirewall = true; - settings = { - "public" = { - "path" = "/public"; - "read only" = true; - "browseable" = "yes"; - "guest ok" = "yes"; - "comment" = "Public samba share."; - }; - }; - }; - }; - }; + testScript = '' + server.start() + server.wait_for_unit("samba.target") + server.succeed("mkdir -p /public; echo bar > /public/foo") - testScript = '' - server.start() - server.wait_for_unit("samba.target") - server.succeed("mkdir -p /public; echo bar > /public/foo") - - client.start() - client.wait_for_unit("remote-fs.target") - client.succeed("[[ $(cat /public/foo) = bar ]]") - ''; - } -) + client.start() + client.wait_for_unit("remote-fs.target") + client.succeed("[[ $(cat /public/foo) = bar ]]") + ''; +}