X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fmain_sync_test.go;h=fdbe98fba8764565551f7d4e8845789957c12db4;hb=9d0d090fc1d683accc8bd1b354425c23cbe9fb6a;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..fdbe98f 100644 --- a/cmd/safcm/main_sync_test.go +++ b/cmd/safcm/main_sync_test.go @@ -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 {