Skip to content

Commit

Permalink
feat(update-collection-v3): migrate otelevents.config.override
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Nov 25, 2022
1 parent 5573f7e commit 5837f52
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/go/cmd/update-collection-v3/migrations/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func migrateEvents(
commonPersistence.PersistentVolume.PvcLabels = otPersistence.PvcLabels
}
}

// move config.override to config.merge
otelV3.Config.Merge = otelV2.Config.Override

return commonV3, fluentDV3, otelV3
}

Expand Down
25 changes: 25 additions & 0 deletions src/go/cmd/update-collection-v3/migrations/events/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,28 @@ fluentd:
})
}
}

func Test_EventsConfig(t *testing.T) {
testCases := []TestCase{
{
inputYaml: `
otelevents:
config:
override:
key: value
`,
outputYaml: `
otelevents:
config:
merge:
key: value
`,
description: "Move config.override to config.merge",
},
}
for _, testCase := range testCases {
t.Run(testCase.description, func(t *testing.T) {
runYamlTest(t, testCase)
})
}
}
3 changes: 3 additions & 0 deletions src/go/cmd/update-collection-v3/migrations/events/valuesv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ type OteleventsV2 struct {
Size *string `yaml:"size,omitempty"`
PvcLabels map[string]interface{} `yaml:"pvcLabels,omitempty"`
} `yaml:"persistence,omitempty"`
Config struct {
Override map[string]interface{} `yaml:"override,omitempty"`
} `yaml:"config,omitempty"`
Rest map[string]interface{} `yaml:",inline"`
}
4 changes: 4 additions & 0 deletions src/go/cmd/update-collection-v3/migrations/events/valuesv3.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ type CommonEventsV3 struct {
}

type OteleventsV3 struct {
Config struct {
Merge map[string]interface{} `yaml:"merge,omitempty"`
Override map[string]interface{} `yaml:"override,omitempty"`
} `yaml:"config,omitempty"`
Rest map[string]interface{} `yaml:",inline"`
}

0 comments on commit 5837f52

Please sign in to comment.