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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 3 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy