From be1ab965014bda9f380bfdfaf61194ffed4b14ae Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Wed, 25 Mar 2026 15:26:04 +0100 Subject: [PATCH 1/2] inttest/framework: fix volume mount handling Previously, the framework made it possible to mount multiple host directories to the same container directory, but not vice versa. That is the opposite of what container engines allow. It is possible to mount the same host dir to multiple container dirs, but not the other way around. Change the behavior to match container engines. Calling AddVolume or AddVolumeWithOptions twice with the same containerDir will now mount the last hostDir, and calling it twice with the same hostDir will mount it at both the containerDirs. Assisted-by: Claude Signed-off-by: Adam Cmiel --- .../framework/runner_container.go | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/integration_tests/framework/runner_container.go b/integration_tests/framework/runner_container.go index df97e9f9..cf623a20 100644 --- a/integration_tests/framework/runner_container.go +++ b/integration_tests/framework/runner_container.go @@ -33,7 +33,7 @@ type TestRunnerContainer struct { user string privileged bool env map[string]string - volumes map[string]string + volumes map[string]hostMount // container dir => (host dir, options) ports map[string]string networks []string results map[string]string @@ -43,6 +43,11 @@ type TestRunnerContainer struct { containerStatus ContainerStatus } +type hostMount struct { + path string + options string +} + // ContainerOption is a functional-style option for configuring TestRunnerContainer. type ContainerOption func(*TestRunnerContainer) @@ -54,7 +59,7 @@ func NewTestRunnerContainer(name, image string, opts ...ContainerOption) *TestRu name: name, image: image, env: make(map[string]string), - volumes: make(map[string]string), + volumes: make(map[string]hostMount), ports: make(map[string]string), results: make(map[string]string), } @@ -133,7 +138,7 @@ func WithEnv(key, value string) ContainerOption { func (c *TestRunnerContainer) AddVolume(hostPath, containerPath string) { c.ensureContainerNotStarted() - c.volumes[hostPath] = containerPath + c.volumes[containerPath] = hostMount{path: hostPath} } func WithVolume(hostPath, containerPath string) ContainerOption { @@ -144,7 +149,7 @@ func WithVolume(hostPath, containerPath string) ContainerOption { func (c *TestRunnerContainer) AddVolumeWithOptions(hostPath, containerPath, mountOptions string) { c.ensureContainerNotStarted() - c.volumes[hostPath] = containerPath + ":" + mountOptions + c.volumes[containerPath] = hostMount{path: hostPath, options: mountOptions} } func WithVolumeWithOptions(hostPath, containerPath, mountOptions string) ContainerOption { @@ -220,8 +225,12 @@ func (c *TestRunnerContainer) Start() error { for name, value := range c.env { args = append(args, "-e", name+"="+value) } - for hostPath, containerPath := range c.volumes { - args = append(args, "-v", hostPath+":"+containerPath) + for containerPath, mount := range c.volumes { + volumeArg := mount.path + ":" + containerPath + if mount.options != "" { + volumeArg += ":" + mount.options + } + args = append(args, "-v", volumeArg) } for hostPort, containerPort := range c.ports { args = append(args, "-p", hostPort+":"+containerPort) From e75929f57c14c5c283007d6c5f53c8252ee3390a Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Wed, 25 Mar 2026 15:31:12 +0100 Subject: [PATCH 2/2] inttest/build: fix image-pull-proxy test Previously, the test only worked if it was the first test that uses the baseImage. Otherwise, the image was already stored in the local container storage and no additional requests went through the proxy. Fix by using a clean container storage dir for this test. Signed-off-by: Adam Cmiel --- integration_tests/build_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/integration_tests/build_test.go b/integration_tests/build_test.go index f232dd31..6aeb11ef 100644 --- a/integration_tests/build_test.go +++ b/integration_tests/build_test.go @@ -2464,6 +2464,11 @@ RUN cp /random-data.bin /data/realBaseImage.bin contextDir := setupTestContext(t) writeContainerfile(contextDir, fmt.Sprintf("FROM %s\n", baseImage)) + // Use a clean container storage dir for this test to ensure the image gets pulled + containerStorage, err := createContainerStorageDir() + t.Cleanup(func() { removeContainerStorageDir(containerStorage) }) + Expect(err).ToNot(HaveOccurred()) + outputRef := "localhost/test-image-pull-proxy:" + GenerateUniqueTag(t) buildParams := BuildParams{ @@ -2473,9 +2478,10 @@ RUN cp /random-data.bin /data/realBaseImage.bin ImagePullProxy: "http://" + proxyAddr, } - container := setupBuildContainerWithCleanup(t, buildParams, nil) + container := setupBuildContainerWithCleanup(t, buildParams, nil, + maybeMountContainerStorage(containerStorage, "taskuser")) - err := runBuild(container, buildParams) + err = runBuild(container, buildParams) Expect(err).ToNot(HaveOccurred()) _, proxiedRegistry := connectedHosts.Load("registry.access.redhat.com:443")