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

test: fix concurrent map write of TestValidateFormType#390

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
Emyrk merged 1 commit intomainfromstevenmasley/flakey_TestValidateFormType
May 2, 2025
Merged
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
9 changes: 5 additions & 4 deletionsprovider/formtype_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@ import (
"regexp"
"strconv"
"strings"
"sync"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand DownExpand Up@@ -53,7 +54,7 @@ func TestValidateFormType(t *testing.T) {
// formTypesChecked keeps track of all checks run. It will be used to
// ensure all combinations of form_type and option_type are tested.
// All untested options are assumed to throw an error.
formTypesChecked:= make(map[string]struct{})
varformTypesCheckedsync.Map

expectType := func(expected provider.ParameterFormType, opts formTypeCheck) formTypeTestCase {
ftname := opts.formType
Expand DownExpand Up@@ -240,12 +241,12 @@ func TestValidateFormType(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
t.Parallel()
if _, ok := formTypesChecked[c.config.String()]; ok {
if _, ok := formTypesChecked.Load(c.config.String()); ok {
t.Log("Duplicated form type check, delete this extra test case")
t.Fatalf("form type %q already checked", c.config.String())
}

formTypesChecked[c.config.String()] =struct{}{}
formTypesChecked.Store(c.config.String(),struct{}{})
formTypeTest(t, c)
})
}
Expand DownExpand Up@@ -282,7 +283,7 @@ func TestValidateFormType(t *testing.T) {
}

for _, check := range requiredChecks {
if _, alreadyChecked := formTypesChecked[check.String()]; alreadyChecked {
if _, alreadyChecked := formTypesChecked.Load(check.String()); alreadyChecked {
continue
}

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp