Skip to content

Commit

Permalink
add profiles unicity check
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <[email protected]>
  • Loading branch information
glours committed Jan 25, 2024
1 parent 3dadde6 commit c14dde2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions override/merge_profiles_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright 2020 The Compose Specification Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package override

import (
"testing"
)

func TestMergeProfilesUnicity(t *testing.T) {
assertMergeYaml(t, `
services:
test:
image: foo
profiles:
- profile1
- profile2
`, `
services:
test:
profiles:
- profile2
- profile3
`, `
services:
test:
image: foo
profiles:
- profile1
- profile2
- profile3
`)
}
1 change: 1 addition & 0 deletions override/uncity.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func init() {
unique["services.*.networks.*.aliases"] = keyValueIndexer
unique["services.*.networks.*.link_local_ips"] = keyValueIndexer
unique["services.*.ports"] = portIndexer
unique["services.*.profiles"] = keyValueIndexer
unique["services.*.secrets"] = mountIndexer("/run/secrets")
unique["services.*.sysctls"] = keyValueIndexer
unique["services.*.volumes"] = volumeIndexer
Expand Down

0 comments on commit c14dde2

Please sign in to comment.