Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 1.54 KB

TESTING.md

File metadata and controls

64 lines (44 loc) · 1.54 KB

Testing the module

Unit testing

You can test the provider, by running make test.

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

Running the acceptance tests with mocks

By default, mocks are used during acceptance tests.

make testacc

Running the acceptance tests on real resources

⚠️ This will cost money.

export TF_UPDATE_CASSETTES=true
make testacc

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

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

For testing the domain API, it will use the first available domain in your domains list. You need to have a valid domain.

You can force the test domain with an environment var:

export TF_TEST_DOMAIN=your-domain.tld

For testing a domain zone you can force the following environment var:

export TF_TEST_DOMAIN_ZONE=your-zone

To ease debugging you can also set:

export TF_LOG=DEBUG
export SCW_DEBUG=1

Running a single test:

TF_UPDATE_CASSETTES=true TF_LOG=DEBUG SCW_DEBUG=1 TF_ACC=1 go test ./scaleway -v -run=TestAccScalewayDataSourceRDBInstance_Basic -timeout=120m -parallel=10