Skip to content

Commit

Permalink
Fix: Issue auth0#901 Add auth0 environment variables for integrations…
Browse files Browse the repository at this point in the history
… test

Added explicit calls to the run script with the environment variable
Added the `GOBIN` to the path for sake of the script
Added clear instructions to CONTRIBUTING.md
  • Loading branch information
Michael Christenson II committed Nov 7, 2023
1 parent 52be860 commit 94fc071
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@
2. Clone this repo: `git clone [email protected]:auth0/auth0-cli`
3. `make test` - ensure everything works correctly. Should see things pass.

### Adjusting your Development Environment (Optional)

To pass the integration tests, you must have the `AUTH0_CLI_CLIENT_DOMAIN`, `AUTH0_CLI_CLIENT_ID` and `AUTH0_CLI_CLIENT_SECRET` environment variable set. To get these values, you can:

1. Install [jq](https://jqlang.github.io/jq/)
2. [Setup a Machine-to-Machine application](https://auth0.com/docs/get-started/auth0-overview/create-applications/machine-to-machine-apps)
3. Use the resulting **Client Secret** values

#### Using the Bash or Zsh shell

You can set these variables in your `~/.bashrc` or `~/.zshrc` (replace the values with your own):

```shell
export AUTH0_CLI_CLIENT_DOMAIN="yourappdomain"
export AUTH0_CLI_CLIENT_ID="yourclientid"
export AUTH0_CLI_CLIENT_SECRET="yourcedentialsecret"
```

## Build and run on native platform

From the top-level directory:
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,14 @@ test-unit: ## Run unit tests
${call print, "Running unit tests"}
@go test -v -race ${GO_PACKAGES} -coverprofile="coverage-unit-tests.out"

test-integration: install-with-cover $(GO_BIN)/commander ## Run integration tests. To run a specific test pass the FILTER var. Usage: `make test-integration FILTER="attack protection"`
test-integration: install-with-cover $(GO_BIN)/auth0 $(GO_BIN)/commander ## Run integration tests. To run a specific test pass the FILTER var. Usage: `make test-integration FILTER="attack protection"`
${call print, "Running integration tests"}
@mkdir -p "coverage"
@GOCOVERDIR=coverage bash ./test/integration/scripts/run-test-suites.sh
@AUTH0_CLI_CLIENT_DOMAIN=$$AUTH0_CLI_CLIENT_DOMAIN \
AUTH0_CLI_CLIENT_ID=$$AUTH0_CLI_CLIENT_ID \
AUTH0_CLI_CLIENT_SECRET=$$AUTH0_CLI_CLIENT_SECRET \
PATH=$$PATH:$(GO_BIN) \
GOCOVERDIR=coverage bash ./test/integration/scripts/run-test-suites.sh
@go tool covdata textfmt -i "coverage" -o "coverage-integration-tests.out"

test-mocks: $(GO_BIN)/mockgen ## Generate testing mocks using mockgen
Expand Down

0 comments on commit 94fc071

Please sign in to comment.