From a4c607cc71ea5c3a4d4898a84b19cdd236ae90bd Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Thu, 7 May 2020 09:19:00 -0500 Subject: set binding tests to required some small fix ups for binding tests and then make them required. update containers-common V2 bindings tests were failing because of changes introduced in commit a2ad5bb. Fix some typos. Signed-off-by: Lokesh Mandvekar in the case where the specgen attribute for Env and Labels are nil, we should should then make the map IF we have labels and envs that need to be added. Signed-off-by: Brent Baude --- cmd/podman/manifest/annotate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/podman') diff --git a/cmd/podman/manifest/annotate.go b/cmd/podman/manifest/annotate.go index 21d4fb747..82ee1ffda 100644 --- a/cmd/podman/manifest/annotate.go +++ b/cmd/podman/manifest/annotate.go @@ -24,7 +24,7 @@ var ( func init() { registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, + Mode: []entities.EngineMode{entities.ABIMode}, Command: annotateCmd, Parent: manifestCmd, }) -- cgit v1.2.3-54-g00ecf From 20407a2f1fadb1488caac1560dfdd56facff4153 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Thu, 7 May 2020 16:35:48 -0500 Subject: fix pod stats flake it appears that the pod stats flake can be attributed to the fact that the container being run is not fully running when the stats call is made. because the stats call is in format of json, it fails when nil Signed-off-by: Brent Baude --- cmd/podman/containers/stats.go | 1 - test/e2e/stats_test.go | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go index 3f9db671f..5b7f52cc7 100644 --- a/cmd/podman/containers/stats.go +++ b/cmd/podman/containers/stats.go @@ -234,7 +234,6 @@ func outputJSON(stats []*containerStats) error { Pids: j.PIDS(), }) } - b, err := json.MarshalIndent(jstats, "", " ") if err != nil { return err diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index 762417a17..d3af44891 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -5,6 +5,7 @@ package integration import ( "fmt" "os" + "time" "github.com/containers/libpod/pkg/cgroups" . "github.com/containers/libpod/test/utils" @@ -87,13 +88,24 @@ var _ = Describe("Podman stats", func() { }) It("podman stats with json output", func() { + var found bool session := podmanTest.RunTopContainer("") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "json"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - Expect(session.IsJSONOutputValid()).To(BeTrue()) + for i := 0; i < 5; i++ { + ps := podmanTest.Podman([]string{"ps", "-q"}) + ps.WaitWithDefaultTimeout() + if len(ps.OutputToStringArray()) == 1 { + found = true + break + } + time.Sleep(time.Second) + } + Expect(found).To(BeTrue()) + stats := podmanTest.Podman([]string{"stats", "--all", "--no-stream", "--format", "json"}) + stats.WaitWithDefaultTimeout() + Expect(stats.ExitCode()).To(Equal(0)) + Expect(stats.IsJSONOutputValid()).To(BeTrue()) }) It("podman stats on a container with no net ns", func() { -- cgit v1.2.3-54-g00ecf