Skip to content
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
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ linters:
- makezero
- misspell
- nilerr
- paralleltest
- predeclared
- staticcheck
- unconvert
- unparam
- unused
- usetesting

linters-settings:
paralleltest:
# Terraform acceptance subtests all share a Coder instance, and cannot run
# in parallel.
ignore-missing-subtests: true
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ fmt:
go fmt ./...
terraform fmt -recursive

vet:
go vet ./...
lint:
golangci-lint run ./...

gen:
go generate ./...
Expand Down
3 changes: 3 additions & 0 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
// - Runs the `main.tf` specified in the given test directory against the Coder deployment
// - Asserts the state of the deployment via `codersdk`.
func TestIntegration(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "1" {
t.Skip("Skipping integration tests during tf acceptance tests")
}
Expand Down Expand Up @@ -145,6 +146,8 @@ func TestIntegration(t *testing.T) {
},
} {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

client := StartCoder(ctx, t, tt.name, true)
wd, err := os.Getwd()
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions internal/provider/group_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func TestAccGroupDataSource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/group_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func TestAccGroupResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down Expand Up @@ -133,6 +134,7 @@ func TestAccGroupResource(t *testing.T) {
}

func TestAccGroupResourceAGPL(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/license_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestAccLicenseResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/organization_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func TestAccOrganizationDataSource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/organization_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

func TestAccOrganizationResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

func TestAccOrganizationSyncSettingsResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServe
}

func testAccPreCheck(t *testing.T) {
t.Helper()
// You can add code here to run prior to any test case execution, for example assertions
// about the appropriate environment variables being set are common to see in a pre-check
// function.
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provisioner_key_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

func TestAccProvisionerKeyResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/template_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

func TestAccTemplateDataSource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/template_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
)

func TestAccTemplateResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down Expand Up @@ -637,6 +638,7 @@ func TestAccTemplateResource(t *testing.T) {
}

func TestAccTemplateResourceEnterprise(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down Expand Up @@ -782,6 +784,7 @@ func TestAccTemplateResourceEnterprise(t *testing.T) {
}

func TestAccTemplateResourceAGPL(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down Expand Up @@ -875,6 +878,7 @@ func TestAccTemplateResourceAGPL(t *testing.T) {
}

func TestAccTemplateResourceVariables(t *testing.T) {
t.Parallel()
cfg := `
provider coderd {
url = %q
Expand Down Expand Up @@ -1137,6 +1141,7 @@ func testAccCheckNumTemplateVersions(ctx context.Context, client *codersdk.Clien
}

func TestReconcileVersionIDs(t *testing.T) {
t.Parallel()
aUUID := uuid.New()
bUUID := uuid.New()
cases := []struct {
Expand Down Expand Up @@ -1507,6 +1512,8 @@ func TestReconcileVersionIDs(t *testing.T) {
for _, c := range cases {
c := c
t.Run(c.Name, func(t *testing.T) {
t.Parallel()

diag := c.planVersions.reconcileVersionIDs(c.inputState, c.configVersions, c.cfgHasActiveVersion)
if c.expectError {
require.True(t, diag.HasError())
Expand Down
1 change: 1 addition & 0 deletions internal/provider/user_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func TestAccUserDataSource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
1 change: 1 addition & 0 deletions internal/provider/user_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

func TestAccUserResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down
6 changes: 2 additions & 4 deletions internal/provider/uuid_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ func TestUUIDTypeValueFromTerraform(t *testing.T) {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()
ctx := context.Background()

ctx := context.Background()
actual, err := uuidType.ValueFromTerraform(UUIDType, ctx, test.input)
require.NoError(t, err)

require.Equal(t, test.expected, actual)
})
}
Expand Down Expand Up @@ -86,10 +85,9 @@ func TestUUIDToStringValue(t *testing.T) {
name, test := name, test
t.Run(name, func(t *testing.T) {
t.Parallel()
ctx := context.Background()

ctx := context.Background()
s, _ := test.uuid.ToStringValue(ctx)

require.Equal(t, test.expected, s)
})
}
Expand Down
4 changes: 3 additions & 1 deletion internal/provider/workspace_proxy_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

func TestAccWorkspaceProxyResource(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
Expand Down Expand Up @@ -56,11 +57,12 @@ func TestAccWorkspaceProxyResource(t *testing.T) {
}

func TestAccWorkspaceProxyResourceAGPL(t *testing.T) {
t.Parallel()
if os.Getenv("TF_ACC") == "" {
t.Skip("Acceptance tests are disabled.")
}
ctx := context.Background()
client := integration.StartCoder(ctx, t, "ws_proxy_acc", false)
client := integration.StartCoder(ctx, t, "ws_proxy_acc_agpl", false)

cfg1 := testAccWorkspaceProxyResourceConfig{
URL: client.URL.String(),
Expand Down