@@ -54,19 +54,58 @@ func TestInstallWithContentTrust(t *testing.T) {
5454 })
5555}
5656
57- func TestInstallWithContentTrustUntrusted (t * testing.T ) {
57+ func TestCreatePushPull (t * testing.T ) {
58+ // TODO(krissetto): remove this skip once the fix (see https://github.com/moby/moby/pull/47299) is deployed to moby versions < 25
59+ skip .If (t , versions .LessThan (environment .DaemonAPIVersion (t ), "1.44" ))
5860 skip .If (t , environment .SkipPluginTests ())
61+ // t.Skip("flaky")
62+
63+ const pluginName = registryPrefix + "/plugin-content-trust"
5964
6065 dir := fixtures .SetupConfigFile (t )
6166 defer dir .Remove ()
6267
63- result := icmd .RunCmd (icmd .Command ("docker" , "plugin" , "install" , "--grant-all-permissions" , "tiborvass/sample-volume-plugin:latest" ),
68+ ctx , cancel := context .WithCancel (context .Background ())
69+ t .Cleanup (cancel )
70+
71+ pluginDir := testutils .SetupPlugin (t , ctx )
72+ t .Cleanup (pluginDir .Remove )
73+
74+ icmd .RunCommand ("docker" , "plugin" , "create" , pluginName , pluginDir .Path ()).Assert (t , icmd .Success )
75+ result := icmd .RunCmd (icmd .Command ("docker" , "plugin" , "push" , pluginName ),
6476 fixtures .WithConfig (dir .Path ()),
65- fixtures .WithTrust ,
66- fixtures .WithNotary ,
77+ // fixtures.WithTrust,
78+ // fixtures.WithNotary,
79+ fixtures .WithPassphrase ("foo" , "bar" ),
80+ )
81+ result .Assert (t , icmd.Expected {
82+ Out : "Signing and pushing trust metadata" ,
83+ })
84+
85+ icmd .RunCommand ("docker" , "plugin" , "rm" , "-f" , pluginName ).Assert (t , icmd .Success )
86+
87+ result = icmd .RunCmd (icmd .Command ("docker" , "plugin" , "install" , "--grant-all-permissions" , pluginName ),
88+ fixtures .WithConfig (dir .Path ()),
89+ // fixtures.WithTrust,
90+ // fixtures.WithNotary,
6791 )
6892 result .Assert (t , icmd.Expected {
69- ExitCode : 1 ,
70- Err : "Error: remote trust data does not exist" ,
93+ Out : "Installed plugin " + pluginName ,
94+ })
95+ }
96+
97+ func TestInstall (t * testing.T ) {
98+ skip .If (t , environment .SkipPluginTests ())
99+
100+ // dir := fixtures.SetupConfigFile(t)
101+ // defer dir.Remove()
102+
103+ const pluginName = "tiborvass/sample-volume-plugin:latest"
104+ result := icmd .RunCmd (icmd .Command ("docker" , "plugin" , "install" , "--grant-all-permissions" , pluginName )) // fixtures.WithConfig(dir.Path()),
105+ // fixtures.WithTrust,
106+ // fixtures.WithNotary,
107+
108+ result .Assert (t , icmd.Expected {
109+ Out : "Installed plugin " + pluginName ,
71110 })
72111}
0 commit comments