another attempt to fix unexpected mongo tests

This commit is contained in:
Umputun
2018-07-14 13:42:00 -05:00
parent e2360eafe1
commit f9ba969464
2 changed files with 6 additions and 9 deletions
@@ -1,7 +1,6 @@
package mongo
import (
"log"
"os"
"testing"
"time"
@@ -12,13 +11,11 @@ import (
func TestServer_NewServerGood(t *testing.T) {
mongoURL := os.Getenv("MONGO_REMARK_TEST")
if mongoURL == "" {
mongoURL = "mongodb://mongo:27017/test?debug=true"
log.Printf("[WARN] no MONGO_REMARK_TEST in env")
}
if mongoURL == "skip" {
if mongoURL == "" || mongoURL == "skip" {
t.Skip("no MONGO_REMARK_TEST in env")
return
}
m, err := NewServerWithURL(mongoURL, 3*time.Second)
assert.Nil(t, err)
assert.NotNil(t, m)
+3 -3
View File
@@ -22,11 +22,11 @@ var once sync.Once
func MakeTestConnection(t *testing.T) (*Connection, error) {
mongoURL := os.Getenv("MONGO_REMARK_TEST")
if mongoURL == "" {
mongoURL = "mongodb://mongo:27017"
log.Printf("[WARN] no MONGO_REMARK_TEST in env")
t.Skip("no MONGO_REMARK_TEST in env")
return nil, errors.New("skip")
}
if mongoURL == "skip" {
log.Print("skip mongo test")
t.Skip("skip mongo test")
return nil, errors.New("skip")
}