e2e: ensure single image for populator containers

This is useful in environments where the Deployment image is replaced
by another image from an internal registry (via fixture). In that case,
the populator running in populate mode should use the same image as the
populator running in controller mode.
This commit is contained in:
Fabio Bertinatto 2022-06-08 15:08:21 -03:00
parent cfda5bc1d8
commit 9ef5c4e03a

View File

@ -301,20 +301,27 @@ func (p *provisioningTestSuite) DefineTests(driver storageframework.TestDriver,
for i, container := range item.Spec.Template.Spec.Containers { for i, container := range item.Spec.Template.Spec.Containers {
switch container.Name { switch container.Name {
case "hello": case "hello":
var found bool
args := []string{} args := []string{}
var foundNS, foundImage bool
for _, arg := range container.Args { for _, arg := range container.Args {
if strings.HasPrefix(arg, "--namespace=") { if strings.HasPrefix(arg, "--namespace=") {
args = append(args, fmt.Sprintf("--namespace=%s", popNamespace.Name)) args = append(args, fmt.Sprintf("--namespace=%s", popNamespace.Name))
found = true foundNS = true
} else if strings.HasPrefix(arg, "--image-name=") {
args = append(args, fmt.Sprintf("--image-name=%s", container.Image))
foundImage = true
} else { } else {
args = append(args, arg) args = append(args, arg)
} }
} }
if !found { if !foundNS {
args = append(args, fmt.Sprintf("--namespace=%s", popNamespace.Name)) args = append(args, fmt.Sprintf("--namespace=%s", popNamespace.Name))
framework.Logf("container name: %s", container.Name) framework.Logf("container name: %s", container.Name)
} }
if !foundImage {
args = append(args, fmt.Sprintf("--image-name=%s", container.Image))
framework.Logf("container image: %s", container.Image)
}
container.Args = args container.Args = args
item.Spec.Template.Spec.Containers[i] = container item.Spec.Template.Spec.Containers[i] = container
default: default: