aboutsummaryrefslogtreecommitdiffstats
path: root/tests/by-name
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/by-name/at/atuin-sync/test.nix66
-rw-r--r--tests/by-name/gi/git-server/test.nix6
-rw-r--r--tests/by-name/mo/monitoring-basic/test.nix8
-rw-r--r--tests/by-name/mo/monitoring-federation/test.nix2
4 files changed, 45 insertions, 37 deletions
diff --git a/tests/by-name/at/atuin-sync/test.nix b/tests/by-name/at/atuin-sync/test.nix
index 627e89e..cf8f0d8 100644
--- a/tests/by-name/at/atuin-sync/test.nix
+++ b/tests/by-name/at/atuin-sync/test.nix
@@ -1,11 +1,6 @@
{
- nixos-lib,
- pkgsUnstable,
- nixpkgs-unstable,
- vhackPackages,
pkgs,
extraModules,
- nixLib,
turtle,
vhack,
...
@@ -63,9 +58,9 @@ vhack.runTest {
testScript = {nodes, ...}: let
mkSyncConfig = pkgs.writeShellScript "register-atuin-sync-account" ''
- mkdir --parents ~/.config/atuin/
+ mkdir --parents ~/.config/turtle/
- cat << EOF > ~/.config/atuin/config.toml
+ cat << EOF > ~/.config/turtle/config.toml
[sync]
address = "https://atuin-sync.server"
@@ -74,7 +69,7 @@ vhack.runTest {
EOF
'';
- runCommandAndRecordInAtuin = pkgs.writeShellScript "run-command-and-record-in-atuin" ''
+ runCommandAndRecordInTurtle = pkgs.writeShellScript "run-command-and-record-in-atuin" ''
# SPDX-SnippetBegin
# SPDX-SnippetCopyrightText: 2023 mentalisttraceur (https://github.com/mentalisttraceur)
# Source: https://github.com/atuinsh/atuin/issues/1188#issuecomment-1698354107
@@ -83,10 +78,10 @@ vhack.runTest {
local id
local status
local escaped_command="$(printf '%q ' "$@")"
- id="$(atuin history start -- "$escaped_command")"
+ id="$(turtle history start -- "$escaped_command")"
"$@"
status=$?
- atuin history end --exit $status "$id"
+ turtle history end --exit $status "$id"
return $status
}
# SPDX-SnippetEnd
@@ -102,30 +97,28 @@ vhack.runTest {
client1.wait_until_succeeds("curl https://atuin-sync.server")
with subtest("Setup client syncing"):
- # See https://docs.atuin.sh/guide/sync/
for client in [client1, client2]:
client.succeed("${mkSyncConfig}")
- with subtest("Start atuin daemons"):
+ with subtest("Start turtle daemon"):
for client in [client1, client2]:
- client.succeed("systemd-run atuin daemon start")
+ client.succeed("systemd-run turtle-daemon start")
for client in [client1, client2]:
- client.wait_until_succeeds("atuin daemon status")
+ client.wait_until_succeeds("turtle daemon status")
- with subtest("Can import shell history"):
- client1.succeed("${runCommandAndRecordInAtuin} echo hi - client 1")
- client2.succeed("${runCommandAndRecordInAtuin} echo hi - client 2")
+ with subtest("Can generate shell history"):
+ client1.succeed("${runCommandAndRecordInTurtle} echo hi - client 1")
+ client2.succeed("${runCommandAndRecordInTurtle} echo hi - client 2")
- with subtest("Can sync tasks"):
+ with subtest("Can sync"):
for client in [client1, client2]:
- client.succeed("atuin sync perform --force")
- client1.succeed("atuin sync perform --force")
-
+ client.succeed("turtle sync perform")
+ client1.succeed("turtle sync perform")
with subtest("Have correct tasks"):
- hist1 = client1.succeed("atuin history list --session --format '{command}'").strip().split('\n')
- hist2 = client2.succeed("atuin history list --session --format '{command}'").strip().split('\n')
+ hist1 = client1.succeed("turtle history list --cmd-only").strip().split('\n')
+ hist2 = client2.succeed("turtle history list --cmd-only").strip().split('\n')
hist1.sort()
hist2.sort()
@@ -137,5 +130,32 @@ vhack.runTest {
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("turtle sync perform")
+ client1.succeed("turtle sync perform")
+
+ hist1 = client1.succeed("turtle history list --cmd-only").strip().split('\n')
+ hist2 = client2.succeed("turtle history list --cmd-only").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}'"
'';
}
diff --git a/tests/by-name/gi/git-server/test.nix b/tests/by-name/gi/git-server/test.nix
index 6fc3685..b374eb2 100644
--- a/tests/by-name/gi/git-server/test.nix
+++ b/tests/by-name/gi/git-server/test.nix
@@ -1,10 +1,6 @@
{
- nixos-lib,
- pkgsUnstable,
- nixpkgs-unstable,
pkgs,
extraModules,
- nixLib,
vhack,
...
}: let
@@ -69,7 +65,7 @@ in
};
};
- client = {...}: {
+ client = {
environment.systemPackages = [pkgs.git];
programs.ssh.extraConfig = ''
Host *
diff --git a/tests/by-name/mo/monitoring-basic/test.nix b/tests/by-name/mo/monitoring-basic/test.nix
index a00331f..a4d67a9 100644
--- a/tests/by-name/mo/monitoring-basic/test.nix
+++ b/tests/by-name/mo/monitoring-basic/test.nix
@@ -4,14 +4,12 @@
...
}: let
grafanaDomain = "grafana.server.org";
- scrutinyDomain = "scrutiny.server.org";
in
vhack.runTest {
name = "monitoring";
serverDomains = [
{server = grafanaDomain;}
- {server = scrutinyDomain;}
];
nodes = {
@@ -50,11 +48,6 @@ in
prometheus = {
enable = true;
};
-
- scrutiny = {
- enable = true;
- fqdn = scrutinyDomain;
- };
};
};
};
@@ -64,7 +57,6 @@ in
{server = "grafana.service";}
{server = "fluent-bit.service";}
{server = "loki.service";}
- {server = "netdata.service";}
];
testScript = {...}:
diff --git a/tests/by-name/mo/monitoring-federation/test.nix b/tests/by-name/mo/monitoring-federation/test.nix
index a64577d..106bc20 100644
--- a/tests/by-name/mo/monitoring-federation/test.nix
+++ b/tests/by-name/mo/monitoring-federation/test.nix
@@ -88,7 +88,7 @@ in
# Give the Prometheus servers some time to generate metrics and sync with the main
# one.
- time.sleep(1)
+ time.sleep(15)
metrics = server2.succeed("${pkgs.writeShellScript "query-metrics" ''
curl --silent \