diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/images_build.go | 12 | ||||
-rw-r--r-- | pkg/bindings/test/attach_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/auth_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/common_test.go | 4 | ||||
-rw-r--r-- | pkg/bindings/test/connection_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/containers_test.go | 3 | ||||
-rw-r--r-- | pkg/bindings/test/create_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/exec_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/generator_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/images_test.go | 13 | ||||
-rw-r--r-- | pkg/bindings/test/info_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/manifests_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/networks_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/pods_test.go | 6 | ||||
-rw-r--r-- | pkg/bindings/test/resource_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/secrets_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/system_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/test_suite_test.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/volumes_test.go | 2 |
19 files changed, 44 insertions, 22 deletions
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 7bbc4b99c..ac5934c13 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -24,6 +24,7 @@ import ( "github.com/containers/podman/v3/pkg/auth" "github.com/containers/podman/v3/pkg/channel" "github.com/containers/storage/pkg/archive" + "github.com/docker/docker/pkg/jsonmessage" "github.com/gorilla/schema" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" @@ -546,8 +547,10 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { for { m := struct { - Stream string `json:"stream,omitempty"` - Error string `json:"error,omitempty"` + Stream string `json:"stream,omitempty"` + Error *jsonmessage.JSONError `json:"errorDetail,omitempty"` + // NOTE: `error` is being deprecated check https://github.com/moby/moby/blob/master/pkg/jsonmessage/jsonmessage.go#L148 + ErrorMessage string `json:"error,omitempty"` // deprecate this slowly }{} select { @@ -570,7 +573,10 @@ func BuildImage(w http.ResponseWriter, r *http.Request) { } flush() case e := <-stderr.Chan(): - m.Error = string(e) + m.ErrorMessage = string(e) + m.Error = &jsonmessage.JSONError{ + Message: m.ErrorMessage, + } if err := enc.Encode(m); err != nil { logrus.Warnf("Failed to json encode error %v", err) } diff --git a/pkg/bindings/test/attach_test.go b/pkg/bindings/test/attach_test.go index 5c3ec48e4..c78836cb3 100644 --- a/pkg/bindings/test/attach_test.go +++ b/pkg/bindings/test/attach_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "bytes" diff --git a/pkg/bindings/test/auth_test.go b/pkg/bindings/test/auth_test.go index d48a3eff7..26690c46a 100644 --- a/pkg/bindings/test/auth_test.go +++ b/pkg/bindings/test/auth_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "io/ioutil" diff --git a/pkg/bindings/test/common_test.go b/pkg/bindings/test/common_test.go index 233666a48..76649f628 100644 --- a/pkg/bindings/test/common_test.go +++ b/pkg/bindings/test/common_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "context" @@ -51,7 +51,7 @@ var ( shortName: "busybox", tarballName: "busybox.tar", } - CACHE_IMAGES = []testImage{alpine, busybox} + CACHE_IMAGES = []testImage{alpine, busybox} //nolint:golint,stylecheck ) type bindingTest struct { diff --git a/pkg/bindings/test/connection_test.go b/pkg/bindings/test/connection_test.go index 561cf32b5..84a047bc9 100644 --- a/pkg/bindings/test/connection_test.go +++ b/pkg/bindings/test/connection_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "context" diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go index 0f535bc31..b6c06756b 100644 --- a/pkg/bindings/test/containers_test.go +++ b/pkg/bindings/test/containers_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "net/http" @@ -103,6 +103,7 @@ var _ = Describe("Podman containers ", func() { Expect(err).To(BeNil()) // Pause by name err = containers.Pause(bt.conn, name, nil) + Expect(err).To(BeNil(), "error from containers.Pause()") //paused := "paused" //_, err = containers.Wait(bt.conn, cid, &paused) //Expect(err).To(BeNil()) diff --git a/pkg/bindings/test/create_test.go b/pkg/bindings/test/create_test.go index 3c83aac02..f70ba7248 100644 --- a/pkg/bindings/test/create_test.go +++ b/pkg/bindings/test/create_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "time" diff --git a/pkg/bindings/test/exec_test.go b/pkg/bindings/test/exec_test.go index c10452eaf..d2f9b121a 100644 --- a/pkg/bindings/test/exec_test.go +++ b/pkg/bindings/test/exec_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "time" diff --git a/pkg/bindings/test/generator_test.go b/pkg/bindings/test/generator_test.go index d04cc10f9..ab0c49713 100644 --- a/pkg/bindings/test/generator_test.go +++ b/pkg/bindings/test/generator_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "github.com/containers/podman/v3/pkg/bindings/containers" diff --git a/pkg/bindings/test/images_test.go b/pkg/bindings/test/images_test.go index aa8ff0537..8489e6ff1 100644 --- a/pkg/bindings/test/images_test.go +++ b/pkg/bindings/test/images_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "net/http" @@ -89,6 +89,10 @@ var _ = Describe("Podman images", func() { response, errs := images.Remove(bt.conn, []string{"foobar5000"}, nil) Expect(len(errs)).To(BeNumerically(">", 0)) code, _ := bindings.CheckResponseCode(errs[0]) + // FIXME FIXME FIXME: #12441: THIS IS BROKEN + // FIXME FIXME FIXME: we get msg: "foobar5000: image not known" + // FIXME FIXME FIXME: ...with no ResponseCode + Expect(code).To(BeNumerically("==", -1)) // Remove an image by name, validate image is removed and error is nil inspectData, err := images.GetImage(bt.conn, busybox.shortName, nil) @@ -99,6 +103,7 @@ var _ = Describe("Podman images", func() { Expect(inspectData.ID).To(Equal(response.Deleted[0])) inspectData, err = images.GetImage(bt.conn, busybox.shortName, nil) code, _ = bindings.CheckResponseCode(err) + Expect(code).To(BeNumerically("==", http.StatusNotFound)) // Start a container with alpine image var top string = "top" @@ -113,6 +118,9 @@ var _ = Describe("Podman images", func() { // deleting hence image cannot be deleted until the container is deleted. response, errs = images.Remove(bt.conn, []string{alpine.shortName}, nil) code, _ = bindings.CheckResponseCode(errs[0]) + // FIXME FIXME FIXME: #12441: another invalid error + // FIXME FIXME FIXME: this time msg="Image used by SHA: ..." + Expect(code).To(BeNumerically("==", -1)) // Removing the image "alpine" where force = true options := new(images.RemoveOptions).WithForce(true) @@ -122,10 +130,12 @@ var _ = Describe("Podman images", func() { // is gone as well. _, err = containers.Inspect(bt.conn, "top", nil) code, _ = bindings.CheckResponseCode(err) + Expect(code).To(BeNumerically("==", http.StatusNotFound)) // Now make sure both images are gone. inspectData, err = images.GetImage(bt.conn, busybox.shortName, nil) code, _ = bindings.CheckResponseCode(err) + Expect(code).To(BeNumerically("==", http.StatusNotFound)) inspectData, err = images.GetImage(bt.conn, alpine.shortName, nil) code, _ = bindings.CheckResponseCode(err) @@ -339,6 +349,7 @@ var _ = Describe("Podman images", func() { // Search with a fqdn reports, err = images.Search(bt.conn, "quay.io/libpod/alpine_nginx", nil) + Expect(err).To(BeNil(), "Error in images.Search()") Expect(len(reports)).To(BeNumerically(">=", 1)) }) diff --git a/pkg/bindings/test/info_test.go b/pkg/bindings/test/info_test.go index f61e8c370..f643a2c28 100644 --- a/pkg/bindings/test/info_test.go +++ b/pkg/bindings/test/info_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "runtime" diff --git a/pkg/bindings/test/manifests_test.go b/pkg/bindings/test/manifests_test.go index 4d8ca74bf..e65632057 100644 --- a/pkg/bindings/test/manifests_test.go +++ b/pkg/bindings/test/manifests_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "net/http" diff --git a/pkg/bindings/test/networks_test.go b/pkg/bindings/test/networks_test.go index 85ceeb998..d95862f6f 100644 --- a/pkg/bindings/test/networks_test.go +++ b/pkg/bindings/test/networks_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "context" diff --git a/pkg/bindings/test/pods_test.go b/pkg/bindings/test/pods_test.go index 879d4d00d..0a4261ea2 100644 --- a/pkg/bindings/test/pods_test.go +++ b/pkg/bindings/test/pods_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "fmt" @@ -79,6 +79,7 @@ var _ = Describe("Podman pods", func() { var newpod2 string = "newpod2" bt.Podcreate(&newpod2) podSummary, err = pods.List(bt.conn, nil) + Expect(err).To(BeNil(), "Error from pods.List") Expect(len(podSummary)).To(Equal(2)) var names []string for _, i := range podSummary { @@ -106,6 +107,7 @@ var _ = Describe("Podman pods", func() { options := new(pods.ListOptions).WithFilters(filters) filteredPods, err := pods.List(bt.conn, options) Expect(err).ToNot(BeNil()) + Expect(len(filteredPods)).To(Equal(0), "len(filteredPods)") code, _ := bindings.CheckResponseCode(err) Expect(code).To(BeNumerically("==", http.StatusInternalServerError)) @@ -301,6 +303,7 @@ var _ = Describe("Podman pods", func() { // No pods pruned since no pod in exited state pruneResponse, err := pods.Prune(bt.conn, nil) Expect(err).To(BeNil()) + Expect(len(pruneResponse)).To(Equal(0), "len(pruneResponse)") podSummary, err := pods.List(bt.conn, nil) Expect(err).To(BeNil()) Expect(len(podSummary)).To(Equal(2)) @@ -317,6 +320,7 @@ var _ = Describe("Podman pods", func() { Expect(response.State).To(Equal(define.PodStateExited)) pruneResponse, err = pods.Prune(bt.conn, nil) Expect(err).To(BeNil()) + Expect(len(pruneResponse)).To(Equal(1), "len(pruneResponse)") // Validate status and record pod id of pod to be pruned Expect(response.State).To(Equal(define.PodStateExited)) podID := response.ID diff --git a/pkg/bindings/test/resource_test.go b/pkg/bindings/test/resource_test.go index b12d1ccd6..19ac33eb2 100644 --- a/pkg/bindings/test/resource_test.go +++ b/pkg/bindings/test/resource_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "context" diff --git a/pkg/bindings/test/secrets_test.go b/pkg/bindings/test/secrets_test.go index 5edb37f18..52c964556 100644 --- a/pkg/bindings/test/secrets_test.go +++ b/pkg/bindings/test/secrets_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "context" diff --git a/pkg/bindings/test/system_test.go b/pkg/bindings/test/system_test.go index aecc5db81..4549a14c9 100644 --- a/pkg/bindings/test/system_test.go +++ b/pkg/bindings/test/system_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "sync" diff --git a/pkg/bindings/test/test_suite_test.go b/pkg/bindings/test/test_suite_test.go index d2c2c7838..8fb46c205 100644 --- a/pkg/bindings/test/test_suite_test.go +++ b/pkg/bindings/test/test_suite_test.go @@ -1,4 +1,4 @@ -package test_bindings_test +package bindings_test import ( "testing" diff --git a/pkg/bindings/test/volumes_test.go b/pkg/bindings/test/volumes_test.go index 14bda114e..43ef54889 100644 --- a/pkg/bindings/test/volumes_test.go +++ b/pkg/bindings/test/volumes_test.go @@ -1,4 +1,4 @@ -package test_bindings +package bindings_test import ( "context" |