MCPcopy
hub / github.com/moby/moby / TestGetAll

Function TestGetAll

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

Source from the content-addressed store, hash-verified

127}
128
129func TestGetAll(t *testing.T) {
130 t.Parallel()
131
132 tmpdir := t.TempDir()
133 r := LocalRegistry{
134 socketsPath: tmpdir,
135 specsPaths: []string{tmpdir},
136 }
137
138 p := filepath.Join(tmpdir, "example.json")
139 spec := `{
140 "Name": "example",
141 "Addr": "https://example.com/docker/plugin"
142}`
143
144 err := os.WriteFile(p, []byte(spec), 0o644)
145 assert.NilError(t, err)
146
147 plugin, err := r.Plugin("example")
148 assert.NilError(t, err)
149
150 plugin.Manifest = &Manifest{Implements: []string{"apple"}}
151 storage.Lock()
152 storage.plugins["example"] = plugin
153 storage.Unlock()
154
155 fetchedPlugins, err := r.GetAll("apple")
156 assert.NilError(t, err)
157 assert.Check(t, is.Len(fetchedPlugins, 1))
158 assert.Check(t, is.Equal(fetchedPlugins[0].Name(), plugin.Name()))
159}

Callers

nothing calls this directly

Calls 10

PluginMethod · 0.95
GetAllMethod · 0.95
WriteFileMethod · 0.80
UnlockMethod · 0.80
CheckMethod · 0.80
EqualMethod · 0.80
JoinMethod · 0.65
LenMethod · 0.65
NameMethod · 0.65
LockMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…