Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/system: podman play --service-container slog to syslog #23450

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions libpod/pod_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,21 @@ func (p *Pod) stopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
// Can't batch these without forcing Stop() to hold the
// lock for the full duration of the timeout.
// We probably don't want to do that.
var err error
if timeout > -1 {
if err := c.StopWithTimeout(uint(timeout)); err != nil {
return err
}
err = c.StopWithTimeout(uint(timeout))
} else {
if err := c.Stop(); err != nil {
return err
}
err = c.Stop()
}
if err != nil && !errors.Is(err, define.ErrCtrStateInvalid) && !errors.Is(err, define.ErrCtrStopped) {
return err
}

if cleanup {
return c.Cleanup(ctx)
err := c.Cleanup(ctx)
if err != nil && !errors.Is(err, define.ErrCtrStateInvalid) && !errors.Is(err, define.ErrCtrStopped) {
return err
}
}

return nil
Expand All @@ -196,9 +199,6 @@ func (p *Pod) stopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
// Get returned error for every container we worked on
for id, channel := range ctrErrChan {
if err := <-channel; err != nil {
if errors.Is(err, define.ErrCtrStateInvalid) || errors.Is(err, define.ErrCtrStopped) {
continue
}
ctrErrors[id] = err
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/system/700-play.bats
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ RELABEL="system_u:object_r:container_file_t:s0"
# Run `play kube` in the background as it will wait for the service
# container to exit.
timeout --foreground -v --kill=10 60 \
$PODMAN play kube --service-container=true --log-driver journald $TESTYAML &>/dev/null &
$PODMAN --syslog play kube --service-container=true --log-driver journald $TESTYAML &>/dev/null &

# Wait for the container to be running
container_a=$PODCTRNAME
Expand Down Expand Up @@ -212,7 +212,7 @@ RELABEL="system_u:object_r:container_file_t:s0"
is "$output" "true"

# Restart the pod, make sure the service is running again
run_podman pod restart $PODNAME
run_podman --syslog pod restart $PODNAME
run_podman container inspect $service_container --format "{{.State.Running}}"
is "$output" "true"

Expand All @@ -223,11 +223,11 @@ RELABEL="system_u:object_r:container_file_t:s0"
is "$output" "Error: container .* is the service container of pod(s) .* and cannot be removed without removing the pod(s)"

# Kill the pod and make sure the service is not running
run_podman pod kill $PODNAME
run_podman --syslog pod kill $PODNAME
_ensure_container_running $service_container false

# Remove the pod and make sure the service is removed along with it
run_podman pod rm $PODNAME
run_podman --syslog pod rm $PODNAME
run_podman 1 container exists $service_container
}

Expand Down