wip
This commit is contained in:
@@ -14,9 +14,9 @@
|
||||
module.name = "@clan/syncthing";
|
||||
module.input = "self";
|
||||
|
||||
roles.introducer.machines.introducer = {
|
||||
# autoAcceptDevices = true;
|
||||
# autoShares = [ ];
|
||||
roles.introducer.machines.introducer.settings = {
|
||||
autoAcceptDevices = true;
|
||||
autoShares = [ "Shared" ];
|
||||
};
|
||||
roles.peer.machines.peer1 = { };
|
||||
roles.peer.machines.peer2 = { };
|
||||
@@ -24,6 +24,36 @@
|
||||
};
|
||||
};
|
||||
|
||||
nodes = {
|
||||
|
||||
peer1.services.syncthing.openDefaultPorts = true;
|
||||
peer2.services.syncthing.openDefaultPorts = true;
|
||||
|
||||
introducer = {
|
||||
|
||||
services.syncthing.openDefaultPorts = true;
|
||||
|
||||
# For faster Tests
|
||||
systemd.timers.syncthing-auto-accept.timerConfig = {
|
||||
OnActiveSec = 1;
|
||||
OnUnitActiveSec = 1;
|
||||
};
|
||||
|
||||
services.syncthing.settings.folders = {
|
||||
"Shared" = {
|
||||
enable = true;
|
||||
path = "~/Shared";
|
||||
versioning = {
|
||||
type = "trashcan";
|
||||
params = {
|
||||
cleanoutDays = "30";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
@@ -41,7 +71,30 @@
|
||||
peer1.succeed("curl -s http://127.0.0.1:8384")
|
||||
peer2.succeed("curl -s http://127.0.0.1:8384")
|
||||
|
||||
import time
|
||||
time.sleep(500000000)
|
||||
|
||||
# Check that folders are created correctly
|
||||
peer1.execute("ls -la /var/lib/syncthing")
|
||||
peer2.execute("ls -la /var/lib/syncthing")
|
||||
|
||||
# import time
|
||||
# time.sleep(500000)
|
||||
|
||||
# peer1.wait_until_succeeds("timeout 5 ls /var/lib/syncthing/Shared")
|
||||
# peer2.wait_until_succeeds("timeout 5 ls /var/lib/syncthing/Shared")
|
||||
|
||||
peer1.wait_for_file("/var/lib/syncthing/Shared")
|
||||
peer2.wait_for_file("/var/lib/syncthing/Shared")
|
||||
|
||||
# Check file synchronisation from peer1 to peer2
|
||||
introducer.shutdown()
|
||||
|
||||
peer1.execute("echo hello > /var/lib/syncthing/Shared/hello")
|
||||
|
||||
# peer2.wait_until_succeeds("timeout 5 cat /var/lib/syncthing/Shared")
|
||||
peer2.wait_for_file("/var/lib/syncthing/Shared/hello")
|
||||
|
||||
out = peer2.succeed("cat /var/lib/syncthing/Shared/hello")
|
||||
assert "hello" in out
|
||||
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user