Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 893169c

Browse files
authored
fix: duplicate tags map in mutation to resolve race (#14047)
* fix: duplicate tags map in mutation to resolve race See: https://github.com/coder/coder/actions/runs/10149619748/job/28064952716?pr=14046 * Fix deployment values race
1 parent 3209c86 commit 893169c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

enterprise/cli/create_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ func TestEnterpriseCreate(t *testing.T) {
3434
secondTemplates []string
3535
}
3636

37-
dv := coderdtest.DeploymentValues(t)
38-
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
3937
// setupMultipleOrganizations creates an extra organization, assigns a member
4038
// both organizations, and optionally creates templates in each organization.
4139
setupMultipleOrganizations := func(t *testing.T, args setupArgs) setupData {
40+
dv := coderdtest.DeploymentValues(t)
41+
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
4242
ownerClient, first := coderdenttest.New(t, &coderdenttest.Options{
4343
Options: &coderdtest.Options{
4444
DeploymentValues: dv,

provisionersdk/provisionertags.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ const (
1818
// NOTE: "owner" must NEVER be nil. Otherwise it will end up being
1919
// duplicated in the database, as idx_provisioner_daemons_name_owner_key
2020
// is a partial unique index that includes a JSON field.
21-
func MutateTags(userID uuid.UUID, tags map[string]string) map[string]string {
22-
if tags == nil {
23-
tags = map[string]string{}
21+
func MutateTags(userID uuid.UUID, provided map[string]string) map[string]string {
22+
tags := map[string]string{}
23+
for k, v := range provided {
24+
tags[k] = v
2425
}
2526
_, ok := tags[TagScope]
2627
if !ok {

0 commit comments

Comments
 (0)