summaryrefslogtreecommitdiff
path: root/tests/plugins/broadcast/broadcast_plugin_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-18 12:38:36 +0300
committerValery Piashchynski <[email protected]>2021-06-18 12:38:36 +0300
commit1229d24e574f9632ea68dea721fe7ed437afbb85 (patch)
tree334eb3c4a02d8ec559af42850fab2fb45325ddf7 /tests/plugins/broadcast/broadcast_plugin_test.go
parent9e8bad3988c1fec2e545898d529446f7b93e537b (diff)
- Add broadcast tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/broadcast/broadcast_plugin_test.go')
-rw-r--r--tests/plugins/broadcast/broadcast_plugin_test.go65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/plugins/broadcast/broadcast_plugin_test.go b/tests/plugins/broadcast/broadcast_plugin_test.go
index 585a81a9..ce1aed45 100644
--- a/tests/plugins/broadcast/broadcast_plugin_test.go
+++ b/tests/plugins/broadcast/broadcast_plugin_test.go
@@ -92,3 +92,68 @@ func TestBroadcastInit(t *testing.T) {
wg.Wait()
}
+
+func TestBroadcastConfigError(t *testing.T) {
+ cont, err := endure.NewContainer(nil, endure.SetLogLevel(endure.ErrorLevel))
+ assert.NoError(t, err)
+
+ cfg := &config.Viper{
+ Path: "configs/.rr-broadcast-config-error.yaml",
+ Prefix: "rr",
+ }
+
+ err = cont.RegisterAll(
+ cfg,
+ &broadcast.Plugin{},
+ &rpcPlugin.Plugin{},
+ &logger.ZapLogger{},
+ &server.Plugin{},
+ &redis.Plugin{},
+ &websockets.Plugin{},
+ &httpPlugin.Plugin{},
+ &memory.Plugin{},
+ )
+
+ assert.NoError(t, err)
+
+ err = cont.Init()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ _, err = cont.Serve()
+ assert.Error(t, err)
+}
+
+func TestBroadcastNoConfig(t *testing.T) {
+ cont, err := endure.NewContainer(nil, endure.SetLogLevel(endure.ErrorLevel))
+ assert.NoError(t, err)
+
+ cfg := &config.Viper{
+ Path: "configs/.rr-broadcast-no-config.yaml",
+ Prefix: "rr",
+ }
+
+ err = cont.RegisterAll(
+ cfg,
+ &broadcast.Plugin{},
+ &rpcPlugin.Plugin{},
+ &logger.ZapLogger{},
+ &server.Plugin{},
+ &redis.Plugin{},
+ &websockets.Plugin{},
+ &httpPlugin.Plugin{},
+ &memory.Plugin{},
+ )
+
+ assert.NoError(t, err)
+
+ err = cont.Init()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // should be just disabled
+ _, err = cont.Serve()
+ assert.NoError(t, err)
+}