forked from nats-io/nats-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes_test.go
42 lines (35 loc) · 1.02 KB
/
routes_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2013-2014 Apcera Inc. All rights reserved.
package server
import (
"net/url"
"reflect"
"testing"
)
func TestRouteConfig(t *testing.T) {
opts, err := ProcessConfigFile("./configs/cluster.conf")
if err != nil {
t.Fatalf("Received an error reading route config file: %v\n", err)
}
golden := &Options{
Host: "apcera.me",
Port: 4242,
Username: "derek",
Password: "bella",
AuthTimeout: 1.0,
ClusterHost: "127.0.0.1",
ClusterPort: 4244,
ClusterUsername: "route_user",
ClusterPassword: "top_secret",
ClusterAuthTimeout: 1.0,
LogFile: "/tmp/nats_cluster_test.log",
PidFile: "/tmp/nats_cluster_test.pid",
}
// Setup URLs
r1, _ := url.Parse("nats-route://foo:bar@apcera.me:4245")
r2, _ := url.Parse("nats-route://foo:bar@apcera.me:4246")
golden.Routes = []*url.URL{r1, r2}
if !reflect.DeepEqual(golden, opts) {
t.Fatalf("Options are incorrect.\nexpected: %+v\ngot: %+v",
golden, opts)
}
}