Skip to content

Commit e63d6ac

Browse files
docs: Describing how to run acceptance scenario (#817)
Co-authored-by: Rémy Léone <[email protected]>
1 parent 632d693 commit e63d6ac

File tree

2 files changed

+51
-13
lines changed

2 files changed

+51
-13
lines changed

README.md

+1-13
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,4 @@ $ $GOPATH/bin/terraform-provider-scaleway
4545
...
4646
```
4747

48-
In order to test the provider, you can simply run `make test`.
49-
50-
```sh
51-
$ make test
52-
```
53-
54-
In order to run the full suite of Acceptance tests, run `make testacc`.
55-
56-
*Note:* Acceptance tests create real resources, and often cost money to run.
57-
58-
```sh
59-
$ make testacc
60-
```
48+
Please refer to the [TESTING.md](TESTING.md) for testing.

TESTING.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Testing the module
2+
3+
## Unit testing
4+
5+
You can test the provider, by running `make test`.
6+
7+
```sh
8+
make test
9+
```
10+
11+
## Acceptance testing
12+
13+
Acceptance test are made to test the terraform module with real API calls so they will create real resources that will be invoiced.
14+
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)).
15+
16+
### Running the acceptance tests with mocks
17+
18+
By default, mocks are used during acceptance tests.
19+
20+
```sh
21+
make testacc
22+
```
23+
24+
### Running the acceptance tests on real resources
25+
26+
:warning: This will cost money.
27+
28+
```sh
29+
export TF_UPDATE_CASSETTES=true
30+
make testacc
31+
```
32+
33+
It's also required to have Scaleway environment vars available :
34+
35+
```sh
36+
export SCW_ACCESS_KEY=SCWXXXXXXXXXXXXXXXXX
37+
export SCW_SECRET_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
38+
export SCW_DEFAULT_PROJECT_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
39+
```
40+
41+
To ease debugging you can also set:
42+
```sh
43+
export TF_LOG=DEBUG
44+
export SCW_DEBUG=1
45+
```
46+
47+
Running a single test:
48+
```sh
49+
TF_UPDATE_CASSETTES=true;TF_LOG=DEBUG;SCW_DEBUG=1;TF_ACC=1 go test ./scaleway -v -run=TestAccScalewayDataSourceRDBInstance_Basic -timeout=120m -parallel=10
50+
```

0 commit comments

Comments
 (0)