mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
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
This commit is contained in:
@@ -34,11 +34,11 @@ func TestEnterpriseCreate(t *testing.T) {
|
||||
secondTemplates []string
|
||||
}
|
||||
|
||||
dv := coderdtest.DeploymentValues(t)
|
||||
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
|
||||
// setupMultipleOrganizations creates an extra organization, assigns a member
|
||||
// both organizations, and optionally creates templates in each organization.
|
||||
setupMultipleOrganizations := func(t *testing.T, args setupArgs) setupData {
|
||||
dv := coderdtest.DeploymentValues(t)
|
||||
dv.Experiments = []string{string(codersdk.ExperimentMultiOrganization)}
|
||||
ownerClient, first := coderdenttest.New(t, &coderdenttest.Options{
|
||||
Options: &coderdtest.Options{
|
||||
DeploymentValues: dv,
|
||||
|
||||
@@ -18,9 +18,10 @@ const (
|
||||
// NOTE: "owner" must NEVER be nil. Otherwise it will end up being
|
||||
// duplicated in the database, as idx_provisioner_daemons_name_owner_key
|
||||
// is a partial unique index that includes a JSON field.
|
||||
func MutateTags(userID uuid.UUID, tags map[string]string) map[string]string {
|
||||
if tags == nil {
|
||||
tags = map[string]string{}
|
||||
func MutateTags(userID uuid.UUID, provided map[string]string) map[string]string {
|
||||
tags := map[string]string{}
|
||||
for k, v := range provided {
|
||||
tags[k] = v
|
||||
}
|
||||
_, ok := tags[TagScope]
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user