You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds integration tests for the provider against an arbitrary version of Coder.
Example usage:
```
CODER_VERSION="v2.10.0-devel-3a9a7d199-amd64" go test -v ./integration
Testing methodology:
```
- Create an ephemeral Coder instance running in a container
- Perform initial setup
- Import a predefined template that creates a single file
- Create a workspace that populates the file with the actual output
- Compare the actual versus expected output
Copy file name to clipboardExpand all lines: README.md
+40-11
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ to setup your local Terraform to use your local version rather than the registry
20
20
21
21
1. Create a file named `.terraformrc` in your `$HOME` directory
22
22
2. Add the following content:
23
+
23
24
```hcl
24
25
provider_installation {
25
26
# 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
33
34
direct {}
34
35
}
35
36
```
37
+
36
38
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
+
```
47
49
2. Run `terraform init` and observe a warning like `Warning: Provider development overrides are in effect`
48
50
4. Run `go build -o terraform-provider-coder` to build the provider binary, which Terraform will try locate and execute
49
51
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:
0 commit comments