Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7d6db3c

Browse files
committedJun 4, 2024··
testing docs
1 parent d3ecb18 commit 7d6db3c

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed
 

‎README.md

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ to setup your local Terraform to use your local version rather than the registry
2020

2121
1. Create a file named `.terraformrc` in your `$HOME` directory
2222
2. Add the following content:
23+
2324
```hcl
2425
provider_installation {
2526
# Override the coder/coder provider to use your local version
@@ -33,18 +34,46 @@ to setup your local Terraform to use your local version rather than the registry
3334
direct {}
3435
}
3536
```
37+
3638
3. (optional, but recommended) Validate your configuration:
37-
1. Create a new `main.tf` file and include:
38-
```hcl
39-
terraform {
40-
required_providers {
41-
coder = {
42-
source = "coder/coder"
43-
}
44-
}
45-
}
46-
```
39+
1. Create a new `main.tf` file and include:
40+
```hcl
41+
terraform {
42+
required_providers {
43+
coder = {
44+
source = "coder/coder"
45+
}
46+
}
47+
}
48+
```
4749
2. Run `terraform init` and observe a warning like `Warning: Provider development overrides are in effect`
4850
4. Run `go build -o terraform-provider-coder` to build the provider binary, which Terraform will try locate and execute
4951
5. All local Terraform runs will now use your local provider!
50-
6. _**NOTE**: we vendor in this provider into `github.com/coder/coder`, so if you're testing with a local clone then you should also run `go mod edit -replace github.com/coder/terraform-provider-coder=/path/to/terraform-provider-coder` in your clone._
52+
6. _**NOTE**: we vendor in this provider into `github.com/coder/coder`, so if you're testing with a local clone then you should also run `go mod edit -replace github.com/coder/terraform-provider-coder=/path/to/terraform-provider-coder` in your clone._
53+
54+
#### Terraform Acceptance Tests
55+
56+
To run Terraform acceptance tests, run `make testacc`. This will test the provider against the locally installed version of Terraform.
57+
58+
> **Note:** our [CI workflow](./github/workflows/test.yml) runs a test matrix against multiple Terraform versions.
59+
60+
#### Integration Tests
61+
62+
The tests under the `./integration` directory perform the following steps:
63+
64+
- Build the local version of the provider,
65+
- Run an in-memory Coder instance with a specified version,
66+
- Validate the behaviour of the local provider against that specific version of Coder.
67+
68+
To run these integration tests locally:
69+
70+
1. Pull the version of the Coder image you wish to test:
71+
72+
```console
73+
docker pull ghcr.io/coder/coder:main-x.y.z-devel-abcd1234
74+
```
75+
76+
1. Run `CODER_VERSION=main-x.y.z-devel-abcd1234 make test-integration`.
77+
78+
> **Note:** you can specify `CODER_IMAGE` if the Coder image you wish to test is hosted somewhere other than `ghcr.io/coder/coder`.
79+
> For example, `CODER_IMAGE=example.com/repo/coder CODER_VERSION=foobar make test-integration`.

0 commit comments

Comments
 (0)
Please sign in to comment.