]> git.scottworley.com Git - syncthing-autoregister/blobdiff - tests/automatic-enrollment.nix
Fix race: Re-register on file change
[syncthing-autoregister] / tests / automatic-enrollment.nix
index 6520c9f35e5067a9e76fb6b166ccb735c52e8218..617f672e4da38f157986db9d2f7b2d1ef3be764b 100644 (file)
@@ -57,7 +57,7 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
 
 
       def verifyDeviceIDSet(machine, expectedDevice):
 
 
       def verifyDeviceIDSet(machine, expectedDevice):
-          machine.succeed(
+          machine.wait_until_succeeds(
               '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.%s.id | wc -c)" == 63 ))'
               % expectedDevice
           )
               '(( "$(nix eval --raw -f "<nixos/nixos>" config.services.syncthing.declarative.devices.%s.id | wc -c)" == 63 ))'
               % expectedDevice
           )
@@ -82,13 +82,16 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
           "${configurationWithDeviceIDs}"
       )
 
           "${configurationWithDeviceIDs}"
       )
 
+      start_all()
       a.wait_for_unit("syncthing-autoregister.service")
       setConfig(a, configurationWithDeviceIDs)
       verifyDeviceIDSet(a, "a")
       getDeviceFile(a)
 
       a.wait_for_unit("syncthing-autoregister.service")
       setConfig(a, configurationWithDeviceIDs)
       verifyDeviceIDSet(a, "a")
       getDeviceFile(a)
 
+      b.wait_for_unit("syncthing-autoregister.service")
       putDeviceFile(b)
       setConfig(b, configurationWithDeviceIDs)
       verifyDeviceIDSet(b, "a")
       putDeviceFile(b)
       setConfig(b, configurationWithDeviceIDs)
       verifyDeviceIDSet(b, "a")
+      verifyDeviceIDSet(b, "b")
     '';
   })
     '';
   })