tests: add plugin install test w/ digest
Adds a test case for installing a plugin from a remote in the form of `plugin-content-trust@sha256:d98f2f8061...`, which is currently causing the daemon to panic, as we found while running the CLI e2e tests: ``` docker plugin install registry:5000/plugin-content-trust@sha256:d98f2f806144bf4ba62d4ecaf78fec2f2fe350df5a001f6e3b491c393326aedb ``` Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
parent
810ef4d0b6
commit
82dda18898
1 changed files with 43 additions and 0 deletions
|
@ -124,6 +124,49 @@ func TestPluginInstall(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
})
|
||||
|
||||
t.Run("with digest", func(t *testing.T) {
|
||||
ctx := setupTest(t)
|
||||
|
||||
reg := registry.NewV2(t)
|
||||
defer reg.Close()
|
||||
|
||||
name := "test-" + strings.ToLower(t.Name())
|
||||
repo := path.Join(registry.DefaultURL, name+":latest")
|
||||
err := plugin.Create(ctx, client, repo)
|
||||
assert.NilError(t, err)
|
||||
|
||||
rdr, err := client.PluginPush(ctx, repo, "")
|
||||
assert.NilError(t, err)
|
||||
defer rdr.Close()
|
||||
|
||||
buf := &strings.Builder{}
|
||||
assert.NilError(t, err)
|
||||
var digest string
|
||||
assert.NilError(t, jsonmessage.DisplayJSONMessagesStream(rdr, buf, 0, false, func(j jsonmessage.JSONMessage) {
|
||||
if j.Aux != nil {
|
||||
var r types.PushResult
|
||||
assert.NilError(t, json.Unmarshal(*j.Aux, &r))
|
||||
digest = r.Digest
|
||||
}
|
||||
}), buf)
|
||||
|
||||
err = client.PluginRemove(ctx, repo, types.PluginRemoveOptions{Force: true})
|
||||
assert.NilError(t, err)
|
||||
|
||||
rdr, err = client.PluginInstall(ctx, repo, types.PluginInstallOptions{
|
||||
Disabled: true,
|
||||
RemoteRef: repo + "@" + digest,
|
||||
})
|
||||
assert.NilError(t, err)
|
||||
defer rdr.Close()
|
||||
|
||||
_, err = io.Copy(io.Discard, rdr)
|
||||
assert.NilError(t, err)
|
||||
|
||||
_, _, err = client.PluginInspectWithRaw(ctx, repo)
|
||||
assert.NilError(t, err)
|
||||
})
|
||||
|
||||
t.Run("with htpasswd", func(t *testing.T) {
|
||||
ctx := setupTest(t)
|
||||
|
||||
|
|
Loading…
Reference in a new issue