(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func 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 | |
| 95 | func TestPluginWithNoManifest(t *testing.T) { |
| 96 | // TODO: t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…