add mongo

This commit is contained in:
Bel LaPointe
2019-03-14 08:56:39 -06:00
parent 46e8c15573
commit ee88d4bbfd
2 changed files with 117 additions and 0 deletions

View File

@@ -72,6 +72,26 @@ func TestImplementations(t *testing.T) {
cases = append(cases, riak)
}
mongoLN, err := net.Listen("tcp", "localhost:27017")
if err == nil {
defer mongoLN.Close()
go func() {
for {
conn, err := mongoLN.Accept()
if err == nil {
conn.Close()
}
}
}()
}
if mongo1, err := NewMongo("localhost:27017"); err == nil {
cases = append(cases, mongo1)
} else if mongo2, err := NewMongo("localhost:27017", "root", "pass"); err == nil {
cases = append(cases, mongo2)
} else {
t.Errorf("cannot make mongo: %v", err)
}
validKey := "key"
validValue := []byte("value")