summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/specgen/generate/pod_create.go6
-rw-r--r--test/e2e/events_test.go13
2 files changed, 19 insertions, 0 deletions
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index e523aef42..a4027eae7 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -59,6 +59,12 @@ func MakePod(p *entities.PodSpec, rt *libpod.Runtime) (*libpod.Pod, error) {
if err != nil {
return nil, err
}
+ } else {
+ // SavePod is used to save the pod state and trigger a create event even if infra is not created
+ err := rt.SavePod(pod)
+ if err != nil {
+ return nil, err
+ }
}
return pod, nil
}
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
index 46ea10c56..ee0b8761a 100644
--- a/test/e2e/events_test.go
+++ b/test/e2e/events_test.go
@@ -199,4 +199,17 @@ var _ = Describe("Podman events", func() {
wg.Wait()
})
+
+ It("podman events pod creation", func() {
+ create := podmanTest.Podman([]string{"pod", "create", "--infra=false", "--name", "foobarpod"})
+ create.WaitWithDefaultTimeout()
+ Expect(create).Should(Exit(0))
+ id := create.OutputToString()
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "pod=" + id})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(result.OutputToStringArray()).To(HaveLen(1))
+ Expect(result.OutputToString()).To(ContainSubstring("create"))
+ })
+
})