mirror of
https://github.com/containers/podman.git
synced 2025-06-27 21:50:18 +08:00
Merge pull request #15812 from sstosh/checkpoint-export-rawinput
remote: checkpoint --export prints a rawInput or an error on remote
This commit is contained in:
@ -266,16 +266,16 @@ func Checkpoint(w http.ResponseWriter, r *http.Request) {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
if len(reports) != 1 {
|
||||
utils.InternalServerError(w, fmt.Errorf("expected 1 restore report but got %d", len(reports)))
|
||||
return
|
||||
}
|
||||
if reports[0].Err != nil {
|
||||
utils.InternalServerError(w, reports[0].Err)
|
||||
return
|
||||
}
|
||||
|
||||
if !query.Export {
|
||||
if len(reports) != 1 {
|
||||
utils.InternalServerError(w, fmt.Errorf("expected 1 restore report but got %d", len(reports)))
|
||||
return
|
||||
}
|
||||
if reports[0].Err != nil {
|
||||
utils.InternalServerError(w, reports[0].Err)
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusOK, reports[0])
|
||||
return
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func Checkpoint(ctx context.Context, nameOrID string, options *CheckpointOptions
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
if !export {
|
||||
if response.StatusCode != http.StatusOK || !export {
|
||||
return &report, response.Process(&report)
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds [
|
||||
if err != nil {
|
||||
reports = append(reports, &entities.CheckpointReport{Id: c.ID, Err: err})
|
||||
} else {
|
||||
report.RawInput = idToRawInput[report.Id]
|
||||
report.RawInput = idToRawInput[c.ID]
|
||||
reports = append(reports, report)
|
||||
}
|
||||
}
|
||||
|
@ -95,13 +95,15 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
It("podman checkpoint bogus container", func() {
|
||||
session := podmanTest.Podman([]string{"container", "checkpoint", "foobar"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).To(ExitWithError())
|
||||
Expect(session).Should(Exit(125))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("no such container"))
|
||||
})
|
||||
|
||||
It("podman restore bogus container", func() {
|
||||
session := podmanTest.Podman([]string{"container", "restore", "foobar"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).To(ExitWithError())
|
||||
Expect(session).Should(Exit(125))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("no such container or image"))
|
||||
})
|
||||
|
||||
It("podman checkpoint a running container by id", func() {
|
||||
@ -585,6 +587,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -604,6 +607,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -623,6 +627,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -642,6 +647,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -659,6 +665,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(125))
|
||||
Expect(result.ErrorToString()).To(ContainSubstring("not supported"))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
@ -704,6 +711,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -754,6 +762,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -796,6 +805,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -834,6 +844,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -884,6 +895,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -954,6 +966,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result = podmanTest.Podman([]string{"container", "checkpoint", cid, "-e", checkpointFileName})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -1057,6 +1070,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
|
||||
|
||||
@ -1103,6 +1117,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -1317,6 +1332,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -1648,6 +1664,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
@ -1802,6 +1819,7 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
// As the container has been started with '--rm' it will be completely
|
||||
// cleaned up after checkpointing.
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(cid))
|
||||
fixmeFixme14653(podmanTest, cid)
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||
|
Reference in New Issue
Block a user