pull_test.go 729 B

123456789101112131415161718192021222324
  1. package image
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/docker/docker/api/types"
  6. "github.com/docker/docker/api/types/versions"
  7. "github.com/docker/docker/errdefs"
  8. "gotest.tools/v3/assert"
  9. "gotest.tools/v3/skip"
  10. )
  11. func TestImagePullPlatformInvalid(t *testing.T) {
  12. skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.40"), "experimental in older versions")
  13. defer setupTest(t)()
  14. client := testEnv.APIClient()
  15. ctx := context.Background()
  16. _, err := client.ImagePull(ctx, "docker.io/library/hello-world:latest", types.ImagePullOptions{Platform: "foobar"})
  17. assert.Assert(t, err != nil)
  18. assert.ErrorContains(t, err, "unknown operating system or architecture")
  19. assert.Assert(t, errdefs.IsInvalidParameter(err))
  20. }