]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
tests: end-to-end: don't remove helper before almost all tests
authorSimon Ruderich <simon@ruderich.org>
Sat, 1 Nov 2025 08:03:40 +0000 (09:03 +0100)
committerSimon Ruderich <simon@ruderich.org>
Sat, 1 Nov 2025 09:29:33 +0000 (10:29 +0100)
There's no need to test uploading the helper in each test. Not uploading
it also makes the tests run slightly faster (~1s).

cmd/safcm/main_sync_test.go

index 8bb860cc14d18b984c60fca451b49220b72dba0d..dbab3169189cf3acf098ba76aea428c50ac4036d 100644 (file)
@@ -148,20 +148,18 @@ func TestSyncSshEndToEnd(t *testing.T) {
                {
                        "no changes (dry-run)",
                        false,
-                       true,
+                       false,
                        []string{"-n", "no-changes.example.org"},
-                       `<LOG>[info]    [no-changes.example.org] remote helper upload in progress
-<LOG>[info]    [no-changes.example.org] no changes
+                       `<LOG>[info]    [no-changes.example.org] no changes
 `,
                        nil,
                },
                {
                        "no changes (dry-run -log debug2)",
                        false,
-                       true,
+                       false,
                        []string{"-n", "-log", "debug2", "no-changes.example.org"},
-                       `<LOG>[info]    [no-changes.example.org] remote helper upload in progress
-<LOG>[verbose] [no-changes.example.org] host groups: all <DET> <DET> no-changes.example.org
+                       `<LOG>[verbose] [no-changes.example.org] host groups: all <DET> <DET> no-changes.example.org
 <LOG>[verbose] [no-changes.example.org] host group priorities (descending): no-changes.example.org
 <LOG>[debug]   [no-changes.example.org] files: "/" (no-changes.example.org): unchanged
 <LOG>[debug]   [no-changes.example.org] files: "/etc" (no-changes.example.org): unchanged
@@ -173,20 +171,18 @@ func TestSyncSshEndToEnd(t *testing.T) {
                {
                        "no changes",
                        skipUnlessHarmless,
-                       true,
+                       false,
                        []string{"no-changes.example.org"},
-                       `<LOG>[info]    [no-changes.example.org] remote helper upload in progress
-<LOG>[info]    [no-changes.example.org] no changes
+                       `<LOG>[info]    [no-changes.example.org] no changes
 `,
                        nil,
                },
                {
                        "no changes (-log debug2)",
                        skipUnlessHarmless,
-                       true,
+                       false,
                        []string{"-log", "debug2", "no-changes.example.org"},
-                       `<LOG>[info]    [no-changes.example.org] remote helper upload in progress
-<LOG>[verbose] [no-changes.example.org] host groups: all <DET> <DET> no-changes.example.org
+                       `<LOG>[verbose] [no-changes.example.org] host groups: all <DET> <DET> no-changes.example.org
 <LOG>[verbose] [no-changes.example.org] host group priorities (descending): no-changes.example.org
 <LOG>[debug]   [no-changes.example.org] files: "/" (no-changes.example.org): unchanged
 <LOG>[debug]   [no-changes.example.org] files: "/etc" (no-changes.example.org): unchanged
@@ -199,10 +195,9 @@ func TestSyncSshEndToEnd(t *testing.T) {
                {
                        "no effect commands (dry-run)",
                        false,
-                       true,
+                       false,
                        []string{"-n", "no-effect-commands.example.org"},
-                       `<LOG>[info]    [no-effect-commands.example.org] remote helper upload in progress
-<LOG>[info]    [no-effect-commands.example.org] 
+                       `<LOG>[info]    [no-effect-commands.example.org] 
 will execute 2 command(s): (dry-run)
 "echo this is a command"
 "true"
@@ -212,10 +207,9 @@ will execute 2 command(s): (dry-run)
                {
                        "no effect commands (dry-run -log debug2)",
                        false,
-                       true,
+                       false,
                        []string{"-n", "-log", "debug2", "no-effect-commands.example.org"},
-                       `<LOG>[info]    [no-effect-commands.example.org] remote helper upload in progress
-<LOG>[verbose] [no-effect-commands.example.org] host groups: all <DET> <DET> no-effect-commands.example.org
+                       `<LOG>[verbose] [no-effect-commands.example.org] host groups: all <DET> <DET> no-effect-commands.example.org
 <LOG>[verbose] [no-effect-commands.example.org] host group priorities (descending): no-effect-commands.example.org
 <LOG>[info]    [no-effect-commands.example.org] 
 will execute 2 command(s): (dry-run)
@@ -227,10 +221,9 @@ will execute 2 command(s): (dry-run)
                {
                        "no effect commands",
                        false,
-                       true,
+                       false,
                        []string{"no-effect-commands.example.org"},
-                       `<LOG>[info]    [no-effect-commands.example.org] remote helper upload in progress
-<LOG>[info]    [no-effect-commands.example.org] 
+                       `<LOG>[info]    [no-effect-commands.example.org] 
 executed 2 command(s):
 "echo this is a command":
    > this is a command
@@ -241,10 +234,9 @@ executed 2 command(s):
                {
                        "no effect commands (-log debug2)",
                        false,
-                       true,
+                       false,
                        []string{"-log", "debug2", "no-effect-commands.example.org"},
-                       `<LOG>[info]    [no-effect-commands.example.org] remote helper upload in progress
-<LOG>[verbose] [no-effect-commands.example.org] host groups: all <DET> <DET> no-effect-commands.example.org
+                       `<LOG>[verbose] [no-effect-commands.example.org] host groups: all <DET> <DET> no-effect-commands.example.org
 <LOG>[verbose] [no-effect-commands.example.org] host group priorities (descending): no-effect-commands.example.org
 <LOG>[verbose] [no-effect-commands.example.org] commands: running "/bin/sh" "-c" "echo this is a command" (no-effect-commands.example.org)
 <LOG>[debug2]  [no-effect-commands.example.org] commands: command output:
@@ -262,10 +254,9 @@ executed 2 command(s):
                {
                        "no effect commands failing (dry-run)",
                        false,
-                       true,
+                       false,
                        []string{"-n", "no-effect-commands-failing.example.org"},
-                       `<LOG>[info]    [no-effect-commands-failing.example.org] remote helper upload in progress
-<LOG>[info]    [no-effect-commands-failing.example.org] 
+                       `<LOG>[info]    [no-effect-commands-failing.example.org] 
 will execute 2 command(s): (dry-run)
 "echo this is a command"
 "echo failing; false"
@@ -275,10 +266,9 @@ will execute 2 command(s): (dry-run)
                {
                        "no effect commands failing (dry-run -log debug2)",
                        false,
-                       true,
+                       false,
                        []string{"-n", "-log", "debug2", "no-effect-commands-failing.example.org"},
-                       `<LOG>[info]    [no-effect-commands-failing.example.org] remote helper upload in progress
-<LOG>[verbose] [no-effect-commands-failing.example.org] host groups: all <DET> <DET> no-effect-commands-failing.example.org
+                       `<LOG>[verbose] [no-effect-commands-failing.example.org] host groups: all <DET> <DET> no-effect-commands-failing.example.org
 <LOG>[verbose] [no-effect-commands-failing.example.org] host group priorities (descending): no-effect-commands-failing.example.org
 <LOG>[info]    [no-effect-commands-failing.example.org] 
 will execute 2 command(s): (dry-run)
@@ -290,10 +280,9 @@ will execute 2 command(s): (dry-run)
                {
                        "no effect commands failing",
                        false,
-                       true,
+                       false,
                        []string{"no-effect-commands-failing.example.org"},
-                       `<LOG>[info]    [no-effect-commands-failing.example.org] remote helper upload in progress
-<LOG>[info]    [no-effect-commands-failing.example.org] 
+                       `<LOG>[info]    [no-effect-commands-failing.example.org] 
 executed 2 command(s):
 "echo this is a command":
    > this is a command
@@ -306,10 +295,9 @@ executed 2 command(s):
                {
                        "no effect commands failing (-log debug2)",
                        false,
-                       true,
+                       false,
                        []string{"-log", "debug2", "no-effect-commands-failing.example.org"},
-                       `<LOG>[info]    [no-effect-commands-failing.example.org] remote helper upload in progress
-<LOG>[verbose] [no-effect-commands-failing.example.org] host groups: all <DET> <DET> no-effect-commands-failing.example.org
+                       `<LOG>[verbose] [no-effect-commands-failing.example.org] host groups: all <DET> <DET> no-effect-commands-failing.example.org
 <LOG>[verbose] [no-effect-commands-failing.example.org] host group priorities (descending): no-effect-commands-failing.example.org
 <LOG>[verbose] [no-effect-commands-failing.example.org] commands: running "/bin/sh" "-c" "echo this is a command" (no-effect-commands-failing.example.org)
 <LOG>[debug2]  [no-effect-commands-failing.example.org] commands: command output: