From 410a145db2c79896a1572c96256d35e82eda7e2d Mon Sep 17 00:00:00 2001 From: laurentsimon <64505099+laurentsimon@users.noreply.github.com> Date: Wed, 13 Apr 2022 16:00:19 -0700 Subject: [PATCH] fix (#1837) --- clients/githubrepo/branches_e2e_test.go | 6 ++++-- e2e/branch_protection_test.go | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/clients/githubrepo/branches_e2e_test.go b/clients/githubrepo/branches_e2e_test.go index fa6178179e0..626d1b14133 100644 --- a/clients/githubrepo/branches_e2e_test.go +++ b/clients/githubrepo/branches_e2e_test.go @@ -33,9 +33,9 @@ var _ = Describe("E2E TEST: githubrepo.branchesHandler", func() { }) Context("E2E TEST: Validate query cost", func() { - skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only") - It("Should not have increased for HEAD query", func() { + skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only") + repourl := &repoURL{ owner: "ossf", repo: "scorecard", @@ -48,6 +48,8 @@ var _ = Describe("E2E TEST: githubrepo.branchesHandler", func() { Expect(*brancheshandler.data.RateLimit.Cost).Should(BeNumerically("<=", 1)) }) It("Should fail for non-HEAD query", func() { + skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only") + repourl := &repoURL{ owner: "ossf", repo: "scorecard", diff --git a/e2e/branch_protection_test.go b/e2e/branch_protection_test.go index d8fa9362b4c..39fbb11550a 100644 --- a/e2e/branch_protection_test.go +++ b/e2e/branch_protection_test.go @@ -29,9 +29,9 @@ import ( var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() { Context("E2E TEST:Validating branch protection", func() { - skipIfTokenIsNot(patTokenType, "PAT only") - It("Should get non-admin branch protection on other repositories", func() { + skipIfTokenIsNot(patTokenType, "PAT only") + dl := scut.TestDetailLogger{} repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e") Expect(err).Should(BeNil()) @@ -62,6 +62,8 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() { Expect(repoClient.Close()).Should(BeNil()) }) It("Should fail to return branch protection on other repositories", func() { + skipIfTokenIsNot(patTokenType, "PAT only") + dl := scut.TestDetailLogger{} repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-none") Expect(err).Should(BeNil()) @@ -92,6 +94,8 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() { Expect(repoClient.Close()).Should(BeNil()) }) It("Should fail to return branch protection on other repositories", func() { + skipIfTokenIsNot(patTokenType, "PAT only") + dl := scut.TestDetailLogger{} repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-patch-1") Expect(err).Should(BeNil()) @@ -126,9 +130,8 @@ var _ = Describe("E2E TEST PAT:"+checks.CheckBranchProtection, func() { var _ = Describe("E2E TEST GITHUB_TOKEN:"+checks.CheckBranchProtection, func() { Context("E2E TEST:Validating branch protection", func() { - skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only") - It("Should get errors with GITHUB_TOKEN", func() { + skipIfTokenIsNot(githubWorkflowDefaultTokenType, "GITHUB_TOKEN only") dl := scut.TestDetailLogger{} repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e") Expect(err).Should(BeNil())