X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fmain_sync_test.go;h=387caeebef07972ebbb8fce8d24097fc1d8ea4c1;hb=ecbcb0132728cc18016819a214378b642d92278e;hp=16aad166cb5c854842453f89659901dfd959f3d7;hpb=35c082709bb4fae99e61debf65e146507f265fcc;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/main_sync_test.go b/cmd/safcm/main_sync_test.go index 16aad16..387caee 100644 --- a/cmd/safcm/main_sync_test.go +++ b/cmd/safcm/main_sync_test.go @@ -26,7 +26,7 @@ import ( "testing" "time" - ft "ruderich.org/simon/safcm/cmd/safcm-remote/sync/filetest" + ft "ruderich.org/simon/safcm/remote/sync/filetest" "ruderich.org/simon/safcm/testutil" ) @@ -348,6 +348,20 @@ executed 2 command(s): logRegexp := regexp.MustCompile(`^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} `) detectedRegexp := regexp.MustCompile(`detected_\S+`) + t.Run("error before connection is established", func(t *testing.T) { + // Fake $PATH so safcm cannot find the `ssh` binary. + path := os.Getenv("PATH") + os.Setenv("PATH", "") + defer os.Setenv("PATH", path) + + cmd := exec.Command("../../../../../safcm", + "sync", "-n", "no-settings.example.org") + _, err := cmd.CombinedOutput() + if err == nil { + t.Errorf("err = nil") + } + }) + for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { if tc.remove {