summaryrefslogtreecommitdiffstats
path: root/gateway/gateway_test.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-09-09 23:48:00 +0200
committerGitHub <noreply@github.com>2019-09-09 23:48:00 +0200
commit28783a4146361381e57419aa4bcf623f7ab7b80d (patch)
treec796df65d6b02e7151c4d4c7b6714b99df676171 /gateway/gateway_test.go
parentf92927eae5b460e768f6cf5fb97e237640dfbd44 (diff)
downloadmatterbridge-msglm-28783a4146361381e57419aa4bcf623f7ab7b80d.tar.gz
matterbridge-msglm-28783a4146361381e57419aa4bcf623f7ab7b80d.tar.bz2
matterbridge-msglm-28783a4146361381e57419aa4bcf623f7ab7b80d.zip
Do configuration validation on start-up. Fixes #888 (#889)
Fail if: * we don't have any gateways configured * we have gateways configured but with non-existing bridge configuration * we have gateways configured without any configuration
Diffstat (limited to 'gateway/gateway_test.go')
-rw-r--r--gateway/gateway_test.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/gateway/gateway_test.go b/gateway/gateway_test.go
index b9bb5b93..2d1a1065 100644
--- a/gateway/gateway_test.go
+++ b/gateway/gateway_test.go
@@ -15,10 +15,15 @@ import (
var testconfig = []byte(`
[irc.freenode]
+server=""
[mattermost.test]
+server=""
[gitter.42wim]
+server=""
[discord.test]
+server=""
[slack.test]
+server=""
[[gateway]]
name = "bridge1"
@@ -44,10 +49,15 @@ var testconfig = []byte(`
var testconfig2 = []byte(`
[irc.freenode]
+server=""
[mattermost.test]
+server=""
[gitter.42wim]
+server=""
[discord.test]
+server=""
[slack.test]
+server=""
[[gateway]]
name = "bridge1"
@@ -87,8 +97,11 @@ var testconfig2 = []byte(`
var testconfig3 = []byte(`
[irc.zzz]
+server=""
[telegram.zzz]
+server=""
[slack.zzz]
+server=""
[[gateway]]
name="bridge"
enable=true
@@ -176,7 +189,6 @@ func TestNewRouter(t *testing.T) {
assert.Equal(t, 1, len(r.Gateways))
assert.Equal(t, 4, len(r.Gateways["bridge1"].Bridges))
assert.Equal(t, 4, len(r.Gateways["bridge1"].Channels))
-
r = maketestRouter(testconfig2)
assert.Equal(t, 2, len(r.Gateways))
assert.Equal(t, 4, len(r.Gateways["bridge1"].Bridges))