MCPcopy
hub / github.com/moby/moby / TestGet

Function TestGet

pkg/plugins/plugin_test.go:63–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

61}
62
63func TestGet(t *testing.T) {
64 // TODO: t.Parallel()
65 // TestPluginWithNoManifest also registers fruitPlugin
66
67 p := &Plugin{name: fruitPlugin, activateWait: sync.NewCond(&sync.Mutex{})}
68 p.Manifest = &Manifest{Implements: []string{fruitImplements}}
69 storage.Lock()
70 storage.plugins[fruitPlugin] = p
71 storage.Unlock()
72
73 t.Run("success", func(t *testing.T) {
74 plugin, err := Get(fruitPlugin, fruitImplements)
75 assert.NilError(t, err)
76
77 assert.Check(t, is.Equal(p.Name(), plugin.Name()))
78 assert.Check(t, is.Nil(plugin.Client()))
79 assert.Check(t, plugin.IsV1())
80 })
81
82 // check negative case where plugin fruit doesn't implement banana
83 t.Run("not implemented", func(t *testing.T) {
84 _, err := Get("fruit", "banana")
85 assert.Check(t, is.ErrorIs(err, ErrNotImplements))
86 })
87
88 // check negative case where plugin vegetable doesn't exist
89 t.Run("not exists", func(t *testing.T) {
90 _, err := Get(testNonExistingPlugin, "no-such-implementation")
91 assert.Check(t, is.ErrorIs(err, ErrNotFound))
92 })
93}
94
95func TestPluginWithNoManifest(t *testing.T) {
96 // TODO: t.Parallel()

Callers

nothing calls this directly

Calls 10

NameMethod · 0.95
UnlockMethod · 0.80
CheckMethod · 0.80
EqualMethod · 0.80
GetFunction · 0.70
RunMethod · 0.65
NameMethod · 0.65
ClientMethod · 0.65
IsV1Method · 0.65
LockMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…