aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-13 15:44:16 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-13 15:44:16 +0200
commit31cf10b4b9ffeab5f9e6ca43529d201981f9560b (patch)
tree0f8bbde5206302e461eaca80fa4c8840192dd6d0
parentbuild(cargo): Use `mold` as a linker (diff)
downloadatuin-31cf10b4b9ffeab5f9e6ca43529d201981f9560b.zip
tests(basic): Extend to cover repeated sync
-rw-r--r--tests/basic.nix38
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/basic.nix b/tests/basic.nix
index 7495d093..1ee00071 100644
--- a/tests/basic.nix
+++ b/tests/basic.nix
@@ -1,6 +1,9 @@
{pkgs, ...}: {
name = "turtle-sync";
+ # TODO(@bpeetz): This test is flaky. Why I don't know, but it would be good to remove
+ # the flakiness. <2026-06-13>
+
node = {};
nodes = let
@@ -157,6 +160,13 @@
for client in [client1, client2]:
client.succeed("${mkSyncConfig}")
+ with subtest("Start atuin daemon"):
+ for client in [client1, client2]:
+ client.succeed("systemd-run atuin daemon start")
+
+ for client in [client1, client2]:
+ client.wait_until_succeeds("atuin daemon status")
+
with subtest("Can generate shell history"):
client1.succeed("${runCommandAndRecordInTurtle} echo hi - client 1")
client2.succeed("${runCommandAndRecordInTurtle} echo hi - client 2")
@@ -166,7 +176,6 @@
client.succeed("atuin sync perform --force")
client1.succeed("atuin sync perform --force")
-
with subtest("Have correct tasks"):
hist1 = client1.succeed("atuin history list --format '{command}'").strip().split('\n')
hist2 = client2.succeed("atuin history list --format '{command}'").strip().split('\n')
@@ -181,5 +190,32 @@
assert hist1 == hist2, f"The clients don't have the same amount of history items, client1: '{hist1}', client2: '{hist2}'"
assert hist1 == canonicalHistory, f"The history is not correct: '{hist1}' vs. '{canonicalHistory}'"
+
+ with subtest("Can sync again"):
+ client1.succeed("${runCommandAndRecordInTurtle} echo second try - client 1")
+ client2.succeed("${runCommandAndRecordInTurtle} echo second try - client 2")
+
+ for client in [client1, client2]:
+ client.succeed("atuin sync perform --force")
+ client1.succeed("atuin sync perform --force")
+
+ hist1 = client1.succeed("atuin history list --format '{command}'").strip().split('\n')
+ hist2 = client2.succeed("atuin history list --format '{command}'").strip().split('\n')
+
+ hist1.sort()
+ hist2.sort()
+
+ canonicalHistory = [
+ # The old history
+ "echo hi - client 1",
+ "echo hi - client 2",
+
+ # Our newly added history entries
+ "echo second try - client 1",
+ "echo second try - client 2"
+ ]
+
+ assert hist1 == hist2, f"The clients don't have the same amount of history items, client1: '{hist1}', client2: '{hist2}'"
+ assert hist1 == canonicalHistory, f"The history is not correct, got: '{hist1}', expected: '{canonicalHistory}'"
'';
}