Update duplicate env var warning

This commit is contained in:
Jordan Liggitt 2023-11-30 10:38:15 -05:00
parent ad9b60e2c9
commit b6e34187ca
No known key found for this signature in database
2 changed files with 11 additions and 11 deletions

View File

@ -257,7 +257,7 @@ func warningsForPodSpecAndMeta(fieldPath *field.Path, podSpec *api.PodSpec, meta
bad = true
}
if bad {
warnings = append(warnings, fmt.Sprintf("%s: hides previous definition of %q", p.Child("env").Index(i), item.Name))
warnings = append(warnings, fmt.Sprintf("%s: hides previous definition of %q, which may be dropped when using apply", p.Child("env").Index(i), item.Name))
}
} else {
items.Insert(item.Name)

View File

@ -296,16 +296,16 @@ func TestWarnings(t *testing.T) {
}}},
}},
expected: []string{
`spec.initContainers[0].env[1]: hides previous definition of "a"`,
`spec.initContainers[0].env[2]: hides previous definition of "a"`,
`spec.initContainers[0].env[3]: hides previous definition of "a"`,
`spec.initContainers[0].env[4]: hides previous definition of "a"`,
`spec.initContainers[0].env[5]: hides previous definition of "a"`,
`spec.containers[0].env[1]: hides previous definition of "b"`,
`spec.containers[0].env[2]: hides previous definition of "b"`,
`spec.containers[0].env[3]: hides previous definition of "b"`,
`spec.containers[0].env[4]: hides previous definition of "b"`,
`spec.containers[0].env[5]: hides previous definition of "b"`,
`spec.initContainers[0].env[1]: hides previous definition of "a", which may be dropped when using apply`,
`spec.initContainers[0].env[2]: hides previous definition of "a", which may be dropped when using apply`,
`spec.initContainers[0].env[3]: hides previous definition of "a", which may be dropped when using apply`,
`spec.initContainers[0].env[4]: hides previous definition of "a", which may be dropped when using apply`,
`spec.initContainers[0].env[5]: hides previous definition of "a", which may be dropped when using apply`,
`spec.containers[0].env[1]: hides previous definition of "b", which may be dropped when using apply`,
`spec.containers[0].env[2]: hides previous definition of "b", which may be dropped when using apply`,
`spec.containers[0].env[3]: hides previous definition of "b", which may be dropped when using apply`,
`spec.containers[0].env[4]: hides previous definition of "b", which may be dropped when using apply`,
`spec.containers[0].env[5]: hides previous definition of "b", which may be dropped when using apply`,
},
},
{