github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/integration/image/pull_test.go (about)

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