Skip to content

Commit

Permalink
Update e2e tests (#1641)
Browse files Browse the repository at this point in the history
Co-authored-by: Azeem Shaikh <[email protected]>
  • Loading branch information
azeemshaikh38 and azeemsgoogle authored Feb 15, 2022
1 parent 2b206dc commit de5224b
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
max_attempts: 3
retry_on: error
timeout_minutes: 30
command: make ci-e2e
command: make e2e

- name: codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # 2.1.0
Expand Down
19 changes: 5 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ PROTOC := $(shell which protoc)
GORELEASER := goreleaser
IMAGE_NAME = scorecard
OUTPUT = output
IGNORED_CI_TEST="E2E TEST:blob|E2E TEST:executable"
PLATFORM="linux/amd64,linux/arm64,linux/386,linux/arm"
LDFLAGS=$(shell ./scripts/version-ldflags)

Expand Down Expand Up @@ -264,23 +263,15 @@ unit-test: ## Runs unit test without e2e
# run the go tests and gen the file coverage-all used to do the integration with codecov
go test -race -covermode=atomic -coverprofile=unit-coverage.out `go list ./... | grep -v e2e`

e2e: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
e2e: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
$(GINKGO) --race --skip="E2E TEST:executable" -p -v -cover -coverprofile=filename ./...

$(GINKGO): install

ci-e2e: ## Runs CI e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
ci-e2e: build-scorecard check-env | $(GINKGO)
# Run CI e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
$(call ndef, GITHUB_AUTH_TOKEN)
@echo Ignoring these test for ci-e2e $(IGNORED_CI_TEST)
$(GINKGO) -p -v -cover --skip=$(IGNORED_CI_TEST) -coverprofile=e2e-coverage.out ./e2e/...


check-env:
ifndef GITHUB_AUTH_TOKEN
$(error GITHUB_AUTH_TOKEN is undefined)
endif

e2e: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
e2e: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
$(GINKGO) --race -p -v -cover -coverprofile=e2e-coverage.out ./...
###############################################################################
2 changes: 1 addition & 1 deletion e2e/binary_artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/ci_tests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
4 changes: 2 additions & 2 deletions e2e/cii_best_practices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand All @@ -27,7 +27,7 @@ import (
scut "github.com/ossf/scorecard/v4/utests"
)

var _ = Describe("E2E TEST:CIIBestPractices", func() {
var _ = Describe("E2E TEST:"+checks.CheckCIIBestPractices, func() {
Context("E2E TEST:Validating use of CII Best Practices", func() {
It("Should return use of CII Best Practices", func() {
dl := scut.TestDetailLogger{}
Expand Down
4 changes: 2 additions & 2 deletions e2e/code_review_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand All @@ -29,7 +29,7 @@ import (

// TODO: use dedicated repo that don't change.
// TODO: need negative results.
var _ = Describe("E2E TEST:CodeReview", func() {
var _ = Describe("E2E TEST:"+checks.CheckCodeReview, func() {
Context("E2E TEST:Validating use of code reviews", func() {
It("Should return use of code reviews", func() {
dl := scut.TestDetailLogger{}
Expand Down
2 changes: 1 addition & 1 deletion e2e/contributors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/dangerous_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/dependency_update_tool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
18 changes: 1 addition & 17 deletions e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
package e2e

import (
"os"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/log"
Expand All @@ -31,18 +30,3 @@ func TestE2e(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "E2e Suite")
}

var _ = BeforeSuite(func() {
// making sure the GITHUB_AUTH_TOKEN is set prior to running e2e tests
token, contains := os.LookupEnv("GITHUB_AUTH_TOKEN")

Expect(contains).ShouldNot(BeFalse(),
"GITHUB_AUTH_TOKEN env variable is not set.The GITHUB_AUTH_TOKEN env variable has to be set to run e2e test.")
Expect(len(token)).ShouldNot(BeZero(), "Length of the GITHUB_AUTH_TOKEN env variable is zero.")

l := log.NewLogger(log.InfoLevel)
logger = l
})

var _ = AfterSuite(func() {
})
86 changes: 0 additions & 86 deletions e2e/executable_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion e2e/fuzzing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/license_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/maintained_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/packaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/pinned_dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
2 changes: 1 addition & 1 deletion e2e/sast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
4 changes: 2 additions & 2 deletions e2e/security_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand All @@ -26,7 +26,7 @@ import (
scut "github.com/ossf/scorecard/v4/utests"
)

var _ = Describe("E2E TEST:SecurityPolicy", func() {
var _ = Describe("E2E TEST:"+checks.CheckSecurityPolicy, func() {
Context("E2E TEST:Validating security policy", func() {
It("Should return valid security policy", func() {
dl := scut.TestDetailLogger{}
Expand Down
2 changes: 1 addition & 1 deletion e2e/signedreleases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand Down
4 changes: 2 additions & 2 deletions e2e/vulnerabilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package e2e
import (
"context"

. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/ossf/scorecard/v4/checker"
Expand All @@ -27,7 +27,7 @@ import (
scut "github.com/ossf/scorecard/v4/utests"
)

var _ = Describe("E2E TEST:Vulnerabilities", func() {
var _ = Describe("E2E TEST:"+checks.CheckVulnerabilities, func() {
Context("E2E TEST:Validating vulnerabilities status", func() {
It("Should return that there are no vulnerabilities", func() {
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
Expand Down
Loading

0 comments on commit de5224b

Please sign in to comment.