]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/main_sync_test.go
Move implementation of cmd/safcm-remote/ to remote/
[safcm/safcm.git] / cmd / safcm / main_sync_test.go
index 16aad166cb5c854842453f89659901dfd959f3d7..387caeebef07972ebbb8fce8d24097fc1d8ea4c1 100644 (file)
@@ -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 {