mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Merge pull request #16697 from rhatdan/pod
stop reporting errors removing containers that don't exist
This commit is contained in:
@ -44,10 +44,6 @@ func (p *Pod) startInitContainers(ctx context.Context) error {
|
|||||||
icLock.Unlock()
|
icLock.Unlock()
|
||||||
return fmt.Errorf("failed to remove once init container %s: %w", initCon.ID(), err)
|
return fmt.Errorf("failed to remove once init container %s: %w", initCon.ID(), err)
|
||||||
}
|
}
|
||||||
// Removing a container this way requires an explicit call to clean up the db
|
|
||||||
if err := p.runtime.state.RemoveContainerFromPod(p, initCon); err != nil {
|
|
||||||
logrus.Errorf("Removing container %s from database: %v", initCon.ID(), err)
|
|
||||||
}
|
|
||||||
icLock.Unlock()
|
icLock.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ EOF
|
|||||||
run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
|
run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
|
||||||
is "$output" "none" "network mode none is set for the container"
|
is "$output" "none" "network mode none is set for the container"
|
||||||
|
|
||||||
run_podman kube down - < $PODMAN_TMPDIR/test.yaml
|
run_podman kube down $PODMAN_TMPDIR/test.yaml
|
||||||
run_podman 125 inspect test_pod-test
|
run_podman 125 inspect test_pod-test
|
||||||
is "$output" ".*Error: inspecting object: no such object: \"test_pod-test\""
|
is "$output" ".*Error: inspecting object: no such object: \"test_pod-test\""
|
||||||
run_podman pod rm -a
|
run_podman pod rm -a
|
||||||
@ -436,6 +436,38 @@ status: {}
|
|||||||
run_podman rm -f -t0 myyaml
|
run_podman rm -f -t0 myyaml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman play with init container" {
|
||||||
|
TESTDIR=$PODMAN_TMPDIR/testdir
|
||||||
|
mkdir -p $TESTDIR
|
||||||
|
|
||||||
|
testUserYaml="
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: pod
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- command:
|
||||||
|
- ls
|
||||||
|
- /dev/shm/test1
|
||||||
|
image: $IMAGE
|
||||||
|
name: testCtr
|
||||||
|
initContainers:
|
||||||
|
- command:
|
||||||
|
- touch
|
||||||
|
- /dev/shm/test1
|
||||||
|
image: $IMAGE
|
||||||
|
name: initCtr
|
||||||
|
"
|
||||||
|
echo "$testUserYaml" > $PODMAN_TMPDIR/test.yaml
|
||||||
|
run_podman kube play $PODMAN_TMPDIR/test.yaml
|
||||||
|
assert "$output" !~ "level=" "init containers should not generate logrus.Error"
|
||||||
|
run_podman inspect --format "{{.State.ExitCode}}" pod-testCtr
|
||||||
|
is "$output" "0" "init container should have created /dev/shm/test1"
|
||||||
|
|
||||||
|
run_podman kube down $PODMAN_TMPDIR/test.yaml
|
||||||
|
}
|
||||||
|
|
||||||
@test "podman kube play - hostport" {
|
@test "podman kube play - hostport" {
|
||||||
HOST_PORT=$(random_free_port)
|
HOST_PORT=$(random_free_port)
|
||||||
echo "
|
echo "
|
||||||
|
Reference in New Issue
Block a user