2018-03-06 05:15:18 -05:00
package container
import (
"fmt"
"testing"
"github.com/docker/cli/e2e/internal/fixtures"
2018-05-17 07:11:59 -04:00
"github.com/docker/cli/internal/test/environment"
2018-06-08 12:24:26 -04:00
"gotest.tools/icmd"
"gotest.tools/skip"
2018-03-06 05:15:18 -05:00
)
func TestCreateWithContentTrust ( t * testing . T ) {
2018-05-17 07:11:59 -04:00
skip . If ( t , environment . RemoteDaemon ( ) )
2018-03-06 05:15:18 -05:00
dir := fixtures . SetupConfigFile ( t )
defer dir . Remove ( )
image := fixtures . CreateMaskedTrustedRemoteImage ( t , registryPrefix , "trust-create" , "latest" )
defer func ( ) {
icmd . RunCommand ( "docker" , "image" , "rm" , image ) . Assert ( t , icmd . Success )
} ( )
result := icmd . RunCmd (
icmd . Command ( "docker" , "create" , image ) ,
fixtures . WithConfig ( dir . Path ( ) ) ,
fixtures . WithTrust ,
fixtures . WithNotary ,
)
result . Assert ( t , icmd . Expected {
Err : fmt . Sprintf ( "Tagging %s@sha" , image [ : len ( image ) - 7 ] ) ,
} )
}
// FIXME(vdemeester) TestTrustedCreateFromBadTrustServer needs to be backport too (see https://github.com/moby/moby/pull/36515/files#diff-4b1e56bb77ac16f2ccf956fc24cf0a82L331)