mirror of https://github.com/containers/podman.git
k8s-file: podman logs --until --follow exit after time
When you use podman logs with --until and --follow it should exit after the requested until time and not keep hanging forever. This fixes the behavior for the k8s-file backend. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
parent
767947ab88
commit
6038200fe0
|
@ -72,6 +72,14 @@ func (c *Container) readFromLogFile(ctx context.Context, options *logs.LogOption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
go func() {
|
||||||
|
if options.Until.After(time.Now()) {
|
||||||
|
time.Sleep(time.Until(options.Until))
|
||||||
|
if err := t.Stop(); err != nil {
|
||||||
|
logrus.Errorf("Stopping logger: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer options.WaitGroup.Done()
|
defer options.WaitGroup.Done()
|
||||||
|
|
|
@ -373,6 +373,10 @@ $content" "logs --until -f on running container works"
|
||||||
run_podman ${events_backend} rm -t 0 -f $cname
|
run_podman ${events_backend} rm -t 0 -f $cname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman logs - --until --follow k8s-file" {
|
||||||
|
_log_test_follow_until k8s-file
|
||||||
|
}
|
||||||
|
|
||||||
@test "podman logs - --until --follow journald" {
|
@test "podman logs - --until --follow journald" {
|
||||||
# We can't use journald on RHEL as rootless: rhbz#1895105
|
# We can't use journald on RHEL as rootless: rhbz#1895105
|
||||||
skip_if_journald_unavailable
|
skip_if_journald_unavailable
|
||||||
|
|
Loading…
Reference in New Issue