Skip to content

Commit

Permalink
fix TestLoadMultipleUlimits
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Oct 16, 2023
1 parent d66b99e commit ccd80a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 0 additions & 5 deletions loader/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,6 @@ func TestLoadMultipleUlimits(t *testing.T) {
Scale: 1,
},
},
Networks: types.Networks{},
Volumes: types.Volumes{},
Secrets: types.Secrets{},
Configs: types.Configs{},
Extensions: types.Extensions{},
}, config)
})
}
Expand Down
11 changes: 10 additions & 1 deletion override/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func init() {
mergeSpecials["services.*.entrypoint"] = override
mergeSpecials["services.*.healthcheck.test"] = override
mergeSpecials["services.*.environment"] = mergeEnvironment
mergeSpecials["services.*.ulimits.*"] = mergeUlimit
}

// mergeYaml merges map[string]any yaml trees handling special rules
Expand All @@ -60,7 +61,7 @@ func mergeYaml(e any, o any, p tree.Path) (any, error) {
case map[string]any:
other, ok := o.(map[string]any)
if !ok {
return nil, fmt.Errorf("cannont override %s", p)
return nil, fmt.Errorf("cannot override %s", p)
}
return mergeMappings(value, other, p)
case []any:
Expand Down Expand Up @@ -124,6 +125,14 @@ func mergeEnvironment(c any, o any, p tree.Path) (any, error) {
return append(right, left...), nil
}

func mergeUlimit(c any, o any, p tree.Path) (any, error) {
over, ismapping := o.(map[string]any)
if base, ok := o.(map[string]any); ok && ismapping {
return mergeMappings(base, over, p)
}
return o, nil
}

func convertIntoSequence(value any) []any {
switch v := value.(type) {
case map[string]any:
Expand Down

0 comments on commit ccd80a2

Please sign in to comment.