diff --git a/test/busi/base_types.go b/test/busi/base_types.go index ced598a..b2a4a32 100644 --- a/test/busi/base_types.go +++ b/test/busi/base_types.go @@ -17,10 +17,13 @@ import ( "go.mongodb.org/mongo-driver/bson" ) +// StoreHost examples will connect to dtm.pub; tests will connect to localhost +var StoreHost = "localhost" + // BusiConf 1 var BusiConf = dtmcli.DBConf{ Driver: "mysql", - Host: "localhost", + Host: StoreHost, Port: 3306, User: "root", } diff --git a/test/busi/utils.go b/test/busi/utils.go index b144e70..8f68373 100644 --- a/test/busi/utils.go +++ b/test/busi/utils.go @@ -5,7 +5,6 @@ import ( "database/sql" "encoding/json" "fmt" - "os" "strings" sync "sync" "time" @@ -130,7 +129,7 @@ func RedisGet() *redis.Client { once.Do(func() { logger.Debugf("connecting to client redis") rdb = redis.NewClient(&redis.Options{ - Addr: dtmimp.OrString(os.Getenv("BUSI_REDIS"), "localhost:6379"), + Addr: fmt.Sprintf("%s:6379", StoreHost), Username: "root", Password: "", }) @@ -146,8 +145,9 @@ var ( // MongoGet get mongo client func MongoGet() *mongo.Client { mongoOnce.Do(func() { + uri := fmt.Sprintf("mongodb://%s:27017/?retryWrites=false", StoreHost) ctx := context.Background() - client, err := mongo.Connect(ctx, options.Client().ApplyURI("mongodb://localhost:27017/?retryWrites=false")) + client, err := mongo.Connect(ctx, options.Client().ApplyURI(uri)) dtmimp.E2P(err) mongoc = client })