Skip to content

Commit

Permalink
feature - Included the e2e into the PR workflows
Browse files Browse the repository at this point in the history
Validated the presence of the GITHU_AUTH_TOKEN variable presence before running the e2e.

Update the contributing doc with scopes of the personal access token.

Updated the workflow to include the e2e tests.
  • Loading branch information
naveensrinivasan committed Jan 13, 2021
1 parent 91bfea5 commit c4c99cd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ jobs:
run: make test
- name: Build
run: make build
- name: Run e2e
env:
GITHUB_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }}
run: |
go get github.com/onsi/ginkgo/ginkgo@v1.14.2
go mod download
make e2e
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ Following the targets that can be used to test your changes locally.
| make all | Runs go test,golangci lint checks, fmt, go mod tidy | yes |
| make build | Runs go build | yes |

## Permission for GitHub personal access tokens

The personal access token need the following scopes:

- `repo:status` - Access commit status
- `repo_deployment` - Access deployment status
- `public_repo` - Access public repositories

## Where the CI Tests are configured

1. See the [action files](.github/workflows) to check its tests, and the scripts used on it.
Expand Down
8 changes: 8 additions & 0 deletions e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/http"
"os"
"testing"

"github.com/google/go-github/v32/github"
Expand Down Expand Up @@ -32,6 +33,13 @@ func TestE2e(t *testing.T) {
}

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.")

ctx := context.TODO()

logLevel := zap.LevelFlag("verbosity", zap.InfoLevel, "override the default log level")
Expand Down

0 comments on commit c4c99cd

Please sign in to comment.