mirror of https://github.com/databricks/cli.git
Fix git clone integration test for non-existing repo (#610)
## Changes This PR changes the integration test to just check an error is returned rather than asserting specific text is present in the error. This is required because the error returned can be different based on whether git ssh keys have been setup.
This commit is contained in:
parent
e4b66833dd
commit
2f4bf844fc
|
@ -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:")
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue