github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/integration/image/pull_test.go (about)

     1  package image
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/docker/docker/api/types"
     8  	"github.com/docker/docker/api/types/versions"
     9  	"github.com/docker/docker/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  }