github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/e2e/container/create_test.go (about)

     1  package container
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/docker/cli/e2e/internal/fixtures"
     8  	"github.com/docker/cli/internal/test/environment"
     9  	"gotest.tools/icmd"
    10  	"gotest.tools/skip"
    11  )
    12  
    13  func TestCreateWithContentTrust(t *testing.T) {
    14  	skip.If(t, environment.RemoteDaemon())
    15  
    16  	dir := fixtures.SetupConfigFile(t)
    17  	defer dir.Remove()
    18  	image := fixtures.CreateMaskedTrustedRemoteImage(t, registryPrefix, "trust-create", "latest")
    19  
    20  	defer func() {
    21  		icmd.RunCommand("docker", "image", "rm", image).Assert(t, icmd.Success)
    22  	}()
    23  
    24  	result := icmd.RunCmd(
    25  		icmd.Command("docker", "create", image),
    26  		fixtures.WithConfig(dir.Path()),
    27  		fixtures.WithTrust,
    28  		fixtures.WithNotary,
    29  	)
    30  	result.Assert(t, icmd.Expected{
    31  		Err: fmt.Sprintf("Tagging %s@sha", image[:len(image)-7]),
    32  	})
    33  }
    34  
    35  // FIXME(vdemeester) TestTrustedCreateFromBadTrustServer needs to be backport too (see https://github.com/moby/moby/pull/36515/files#diff-4b1e56bb77ac16f2ccf956fc24cf0a82L331)