aboutsummaryrefslogtreecommitdiff
path: root/server/store/config_test.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-10-08 00:57:10 -0500
committerNiall Sheridan <nsheridan@gmail.com>2016-10-11 16:54:47 -0500
commitd6d54ed0bcf3b583fe681db790740cef137401d3 (patch)
tree2da8de7005c14706f83edc8a58360fa435425c92 /server/store/config_test.go
parentbaf7141d1dd0f99d561a2197a909c66dd389809d (diff)
Replace the 'datastore' option with a 'database' option
The 'datastore' string option is deprecated and will be removed in a future version. The new 'database' map option is preferred.
Diffstat (limited to 'server/store/config_test.go')
-rw-r--r--server/store/config_test.go70
1 files changed, 0 insertions, 70 deletions
diff --git a/server/store/config_test.go b/server/store/config_test.go
deleted file mode 100644
index 9a77027..0000000
--- a/server/store/config_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package store
-
-import (
- "reflect"
- "testing"
- "time"
-
- mgo "gopkg.in/mgo.v2"
-)
-
-func TestMySQLConfig(t *testing.T) {
- t.Parallel()
- var tests = []struct {
- in string
- out []string
- }{
- {"mysql:user:passwd:localhost", []string{"mysql", "user:passwd@tcp(localhost:3306)/certs?parseTime=true"}},
- {"mysql:user:passwd:localhost:13306", []string{"mysql", "user:passwd@tcp(localhost:13306)/certs?parseTime=true"}},
- {"mysql:root::localhost", []string{"mysql", "root@tcp(localhost:3306)/certs?parseTime=true"}},
- }
- for _, tt := range tests {
- result := parse(tt.in)
- if !reflect.DeepEqual(result, tt.out) {
- t.Errorf("want %s, got %s", tt.out, result)
- }
- }
-}
-
-func TestMongoConfig(t *testing.T) {
- t.Parallel()
- var tests = []struct {
- in string
- out *mgo.DialInfo
- }{
- {"mongo:user:passwd:host", &mgo.DialInfo{
- Username: "user",
- Password: "passwd",
- Addrs: []string{"host"},
- Database: "certs",
- Timeout: 5 * time.Second,
- }},
- {"mongo:user:passwd:host1,host2", &mgo.DialInfo{
- Username: "user",
- Password: "passwd",
- Addrs: []string{"host1", "host2"},
- Database: "certs",
- Timeout: 5 * time.Second,
- }},
- {"mongo:user:passwd:host1:27017,host2:27017", &mgo.DialInfo{
- Username: "user",
- Password: "passwd",
- Addrs: []string{"host1:27017", "host2:27017"},
- Database: "certs",
- Timeout: 5 * time.Second,
- }},
- {"mongo:user:passwd:host1,host2:27017", &mgo.DialInfo{
- Username: "user",
- Password: "passwd",
- Addrs: []string{"host1", "host2:27017"},
- Database: "certs",
- Timeout: 5 * time.Second,
- }},
- }
- for _, tt := range tests {
- result := parseMongoConfig(tt.in)
- if !reflect.DeepEqual(result, tt.out) {
- t.Errorf("want:\n%+v\ngot:\n%+v", tt.out, result)
- }
- }
-}