From d0dccb0c761df45da7fba00340f1cd5c66c71711 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Fri, 30 Apr 2021 13:09:18 +0300 Subject: - Add Availabler interface implementaion for all plugins - Add tests Signed-off-by: Valery Piashchynski --- tests/plugins/informer/informer_test.go | 11 +++++------ tests/plugins/informer/test_plugin.go | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/plugins/informer/informer_test.go b/tests/plugins/informer/informer_test.go index b6f50fd5..d40d7093 100644 --- a/tests/plugins/informer/informer_test.go +++ b/tests/plugins/informer/informer_test.go @@ -64,10 +64,7 @@ func TestInformerInit(t *testing.T) { select { case e := <-ch: assert.Fail(t, "error", e.Error.Error()) - err = cont.Stop() - if err != nil { - assert.FailNow(t, "error", err.Error()) - } + return case <-sig: err = cont.Stop() if err != nil { @@ -113,9 +110,11 @@ func informerListRPCTest(t *testing.T) { assert.NoError(t, err) client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn)) // WorkerList contains list of workers. - list := make([]string, 0, 0) + list := make([]string, 0, 5) + // Plugins which are expected to be in the list + expected := []string{"rpc", "logs", "informer.plugin1", "config", "server"} err = client.Call("informer.List", true, &list) assert.NoError(t, err) - assert.Equal(t, "informer.plugin1", list[0]) + assert.ElementsMatch(t, list, expected) } diff --git a/tests/plugins/informer/test_plugin.go b/tests/plugins/informer/test_plugin.go index 0c9065a3..db757110 100644 --- a/tests/plugins/informer/test_plugin.go +++ b/tests/plugins/informer/test_plugin.go @@ -49,6 +49,10 @@ func (p1 *Plugin1) Name() string { return "informer.plugin1" } +func (p1 *Plugin1) Available() bool { + return true +} + func (p1 *Plugin1) Workers() []process.State { p, err := p1.server.NewWorkerPool(context.Background(), testPoolConfig, nil) if err != nil { -- cgit v1.2.3 From 5f451ffbba6b9758d61ba70ddd112a8e1570045a Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Fri, 30 Apr 2021 13:41:18 +0300 Subject: - Update CHANGELOG Signed-off-by: Valery Piashchynski --- tests/plugins/informer/test_plugin.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/plugins/informer/test_plugin.go b/tests/plugins/informer/test_plugin.go index db757110..43335999 100644 --- a/tests/plugins/informer/test_plugin.go +++ b/tests/plugins/informer/test_plugin.go @@ -49,9 +49,7 @@ func (p1 *Plugin1) Name() string { return "informer.plugin1" } -func (p1 *Plugin1) Available() bool { - return true -} +func (p1 *Plugin1) Available() {} func (p1 *Plugin1) Workers() []process.State { p, err := p1.server.NewWorkerPool(context.Background(), testPoolConfig, nil) -- cgit v1.2.3