diff --git a/internal/git_clone_test.go b/internal/git_clone_test.go index b280ebc7..3fb69b92 100644 --- a/internal/git_clone_test.go +++ b/internal/git_clone_test.go @@ -53,11 +53,12 @@ func TestAccGitCloneWithOnlyRepoNameOnAlternateBranch(t *testing.T) { assert.Contains(t, string(b), "dais-2022") } -func TestAccGitCloneRepositoryDoesNotExist(t *testing.T) { +func TestAccGitCloneErrorsWhenRepositoryDoesNotExist(t *testing.T) { t.Log(GetEnvOrSkipTest(t, "CLOUD_ENV")) tmpDir := t.TempDir() - err := git.Clone(context.Background(), "doesnot-exist", "", tmpDir) - assert.Contains(t, err.Error(), `repository 'https://github.com/databricks/doesnot-exist/' not found`) + err := git.Clone(context.Background(), "https://github.com/monalisa/doesnot-exist.git", "", tmpDir) + // Expect the error to originate from shelling out to `git clone` + assert.ErrorContains(t, err, "git clone failed:") } diff --git a/libs/git/clone.go b/libs/git/clone.go index ec663272..8b075cde 100644 --- a/libs/git/clone.go +++ b/libs/git/clone.go @@ -60,7 +60,7 @@ func Clone(ctx context.Context, url, reference, targetPath string) error { return fmt.Errorf("please install git CLI to clone a repository: %w", err) } if err != nil { - return err + return fmt.Errorf("git clone failed: %w", err) } // wait for git clone to complete