diff --git a/pkg/cmd/git/clone/clone_test.go b/pkg/cmd/git/clone/clone_test.go index c81f4b009..4f0b2a1ef 100644 --- a/pkg/cmd/git/clone/clone_test.go +++ b/pkg/cmd/git/clone/clone_test.go @@ -1,6 +1,7 @@ package clone_test import ( + "os" "path/filepath" "testing" @@ -44,6 +45,9 @@ func TestGitClone(t *testing.T) { t.Logf("creating git credentials file %s", o.OutputFile) + // Unset GITHUB_TOKEN for the duration of the test + os.Unsetenv("GITHUB_TOKEN") + err := o.Run() require.NoError(t, err, "failed to run git setup") diff --git a/pkg/cmd/git/get/get_test.go b/pkg/cmd/git/get/get_test.go index 0ed6e096d..8eb8c05e3 100644 --- a/pkg/cmd/git/get/get_test.go +++ b/pkg/cmd/git/get/get_test.go @@ -17,8 +17,7 @@ func TestGitGetFromRepository(t *testing.T) { _, o := get.NewCmdGitGet() o.SourceURL = "https://github.com/jenkins-x-plugins/jx-gitops" - o.Branch = "master" - // ToDo(ankitm123): Rename test_data to testdata after changes are made in go-scm + o.Branch = "main" o.ScmClient, _ = fake.NewDefault() o.Dir = tmpDir o.Path = "expected.txt" @@ -48,7 +47,7 @@ func TestGitGetFromEnvironment(t *testing.T) { _, o := get.NewCmdGitGet() o.SourceURL = "https://github.com/jenkins-x-plugins/jx-gitops" - o.Branch = "master" + o.Branch = "main" o.ScmClient, _ = fake.NewDefault() o.JXClient = jxClient o.Dir = tmpDir diff --git a/pkg/cmd/git/get/test_data/myorg/myrepo/expected.txt b/pkg/cmd/git/get/testdata/myorg/myrepo/expected.txt similarity index 100% rename from pkg/cmd/git/get/test_data/myorg/myrepo/expected.txt rename to pkg/cmd/git/get/testdata/myorg/myrepo/expected.txt diff --git a/pkg/cmd/git/setup/setup_test.go b/pkg/cmd/git/setup/setup_test.go index b77d30f43..a7562f5c0 100644 --- a/pkg/cmd/git/setup/setup_test.go +++ b/pkg/cmd/git/setup/setup_test.go @@ -62,6 +62,9 @@ func TestGitSetup(t *testing.T) { t.Logf("creating git credentials file %s", o.OutputFile) + // Unset GITHUB_TOKEN for the duration of the test + os.Unsetenv("GITHUB_TOKEN") + err = o.Run() require.NoError(t, err, "failed to run git setup")