From 3a38343576c1f6a13944f97a5c8c4b37b6dd00f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Sun, 24 Nov 2019 01:37:18 +0100 Subject: [PATCH] nixosTests.glusterfs: port to python Also fix a hardcoded sleep. --- nixos/tests/glusterfs.nix | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/nixos/tests/glusterfs.nix b/nixos/tests/glusterfs.nix index 9fd8bd2ed129..8f9cb8973d51 100644 --- a/nixos/tests/glusterfs.nix +++ b/nixos/tests/glusterfs.nix @@ -1,4 +1,4 @@ -import ./make-test.nix ({ ... } : +import ./make-test-python.nix ({pkgs, lib, ...}: let client = { pkgs, ... } : { @@ -39,27 +39,29 @@ in { }; testScript = '' - $server1->waitForUnit("glusterd.service"); - $server2->waitForUnit("glusterd.service"); + server1.wait_for_unit("glusterd.service") + server2.wait_for_unit("glusterd.service") + + server1.wait_until_succeeds("gluster peer status") + server2.wait_until_succeeds("gluster peer status") # establish initial contact - $server1->succeed("sleep 2"); - $server1->succeed("gluster peer probe server2"); - $server1->succeed("gluster peer probe server1"); + server1.succeed("gluster peer probe server2") + server1.succeed("gluster peer probe server1") - $server1->succeed("gluster peer status | grep Connected"); + server1.succeed("gluster peer status | grep Connected") # create volumes - $server1->succeed("mkdir -p /data/vg0"); - $server2->succeed("mkdir -p /data/vg0"); - $server1->succeed("gluster volume create gv0 server1:/data/vg0 server2:/data/vg0"); - $server1->succeed("gluster volume start gv0"); + server1.succeed("mkdir -p /data/vg0") + server2.succeed("mkdir -p /data/vg0") + server1.succeed("gluster volume create gv0 server1:/data/vg0 server2:/data/vg0") + server1.succeed("gluster volume start gv0") # test clients - $client1->waitForUnit("gluster.mount"); - $client2->waitForUnit("gluster.mount"); + client1.wait_for_unit("gluster.mount") + client2.wait_for_unit("gluster.mount") - $client1->succeed("echo test > /gluster/file1"); - $client2->succeed("grep test /gluster/file1"); + client1.succeed("echo test > /gluster/file1") + client2.succeed("grep test /gluster/file1") ''; })