about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2019-06-11 07:30:31 +0200
committeraszlig <aszlig@nix.build>2019-06-11 07:30:31 +0200
commit715519bf95babeabf28855e2f1e6f9200bdd51e1 (patch)
tree45f01a5caa749c989b5c5c7e22f99bac13705219 /tests
parent4c919e68d71669a09b45d67a18b8ebb5baa21d45 (diff)
tests/luks2-bcache: Wait for cache device
When chomping the cache set UUID introduced in
6ae9056a5a82dd16b745188a7ee6122ed27239f0, this actually has brought a
bug to surface, because when the UUID wasn't chomped the cache device
hasn't been attached at all, because the resulting command looked like
this:

  echo f994bcca-8e52-4b54-9c96-5f5af0711b55
  > /sys/block/$bcache1/bcache/attach

Yes, that's a newline after the echo, so it's just echoing the UUID and
then writes *nothing* into /sys/block/$bcache1/bcache/attach.

Chomping the UUID now results in an error, because the attach is made
directly after creating the device.

So all we need to do here is wait until the cache device was registered
and then do the attach.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'tests')
-rw-r--r--tests/aszlig/dnyarri/luks2-bcache.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/aszlig/dnyarri/luks2-bcache.nix b/tests/aszlig/dnyarri/luks2-bcache.nix
index b81e6f47..0347a0da 100644
--- a/tests/aszlig/dnyarri/luks2-bcache.nix
+++ b/tests/aszlig/dnyarri/luks2-bcache.nix
@@ -94,6 +94,10 @@
       );
       chomp $csetuuid;
 
+      $newmachine->nest('wait for cache device to appear', sub {
+        $newmachine->waitUntilSucceeds("test -e /sys/fs/bcache/$csetuuid");
+      });
+
       $newmachine->succeed(
         "echo $csetuuid > /sys/block/$bcache1/bcache/attach",
         "echo writeback > /sys/block/$bcache1/bcache/cache_mode",