Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Describing how to run acceptance scenario #817

Merged
merged 2 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,4 @@ $ $GOPATH/bin/terraform-provider-scaleway
...
```

In order to test the provider, you can simply run `make test`.

```sh
$ make test
```

In order to run the full suite of Acceptance tests, run `make testacc`.

*Note:* Acceptance tests create real resources, and often cost money to run.

```sh
$ make testacc
```
Please refer to the [TESTING.md](TESTING.md) for testing.
50 changes: 50 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Testing the module

## Unit testing

You can test the provider, by running `make test`.

```sh
make test
```

## Acceptance testing

Acceptance test are made to test the terraform module with real API calls so they will create real resources that will be invoiced.
But in order to run faster tests and avoid bad surprise at the end of the month we shipped the project with mocks (recorded with [go-vcr](https://github.com/dnaeon/go-vcr)).

### Running the acceptance tests with mocks

By default, mocks are used during acceptance tests.

```sh
make testacc
```

### Running the acceptance tests on real resources

:warning: This will cost money.

```sh
export TF_UPDATE_CASSETTES=true
make testacc
```

It's also required to have Scaleway environment vars available :

```sh
export SCW_ACCESS_KEY=SCWXXXXXXXXXXXXXXXXX
export SCW_SECRET_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
export SCW_DEFAULT_PROJECT_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
```

To ease debugging you can also set:
```sh
export TF_LOG=DEBUG
export SCW_DEBUG=1
```

Running a single test:
```sh
TF_UPDATE_CASSETTES=true;TF_LOG=DEBUG;SCW_DEBUG=1;TF_ACC=1 go test ./scaleway -v -run=TestAccScalewayDataSourceRDBInstance_Basic -timeout=120m -parallel=10
```