(t *testing.T)
| 127 | } |
| 128 | |
| 129 | func 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…