Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: addt.Parallel() to speed up tests#184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 5 commits intomainfromlilac/parallel
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsintegration/integration_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 deletionsinternal/provider/group_data_source_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/group_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 deletionsinternal/provider/license_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/organization_data_source_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/organization_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/provider_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/provisioner_key_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/template_data_source_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/template_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 DownExpand 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 DownExpand Up@@ -875,6 +878,7 @@ func TestAccTemplateResourceAGPL(t *testing.T) {
}

func TestAccTemplateResourceVariables(t *testing.T) {
t.Parallel()
cfg := `
provider coderd {
url = %q
Expand DownExpand 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 DownExpand 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 deletionsinternal/provider/user_data_source_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/user_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsinternal/provider/uuid_internal_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 deletioninternal/provider/workspace_proxy_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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

[8]ページ先頭

©2009-2025 Movatter.jp