Skip to content

Commit

Permalink
Better postgresql test defaults on OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed May 7, 2020
1 parent 0209496 commit 99fbdd9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
package postgres

import (
"os"
"runtime"
"testing"

"github.com/stretchr/testify/suite"
Expand All @@ -30,12 +32,17 @@ import (
)

const (
testUser = "postgres"
testPassword = "cadence"
testSchemaDir = "schema/postgres"
)

func getTestClusterOption() *pt.TestBaseOptions {
testUser := "postgres"
testPassword := "cadence"

if runtime.GOOS == "darwin" {
testUser = os.Getenv("USER")
testPassword = ""
}
return &pt.TestBaseOptions{
SQLDBPluginName: PluginName,
DBUsername: testUser,
Expand Down
11 changes: 0 additions & 11 deletions environment/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const (
PostgresDefaultPort = "5432"
)

// SetupEnv setup the necessary env
func SetupEnv() {
if os.Getenv(CassandraSeeds) == "" {
err := os.Setenv(CassandraSeeds, Localhost)
Expand Down Expand Up @@ -139,7 +138,6 @@ func SetupEnv() {
}
}

// GetCassandraAddress return the cassandra address
func GetCassandraAddress() string {
addr := os.Getenv(CassandraSeeds)
if addr == "" {
Expand All @@ -148,7 +146,6 @@ func GetCassandraAddress() string {
return addr
}

// GetCassandraPort return the cassandra port
func GetCassandraPort() int {
port := os.Getenv(CassandraPort)
if port == "" {
Expand All @@ -161,7 +158,6 @@ func GetCassandraPort() int {
return p
}

// GetMySQLAddress return the cassandra address
func GetMySQLAddress() string {
addr := os.Getenv(MySQLSeeds)
if addr == "" {
Expand All @@ -170,7 +166,6 @@ func GetMySQLAddress() string {
return addr
}

// GetMySQLPort return the MySQL port
func GetMySQLPort() int {
port := os.Getenv(MySQLPort)
if port == "" {
Expand All @@ -183,7 +178,6 @@ func GetMySQLPort() int {
return p
}

// GetPostgresAddress return the cassandra address
func GetPostgresAddress() string {
addr := os.Getenv(PostgresSeeds)
if addr == "" {
Expand All @@ -192,7 +186,6 @@ func GetPostgresAddress() string {
return addr
}

// GetPostgresPort return the Postgres port
func GetPostgresPort() int {
port := os.Getenv(PostgresPort)
if port == "" {
Expand All @@ -205,7 +198,6 @@ func GetPostgresPort() int {
return p
}

// GetKafkaAddress return the kafka address
func GetKafkaAddress() string {
addr := os.Getenv(KafkaSeeds)
if addr == "" {
Expand All @@ -214,7 +206,6 @@ func GetKafkaAddress() string {
return addr
}

// GetKafkaPort return the Kafka port
func GetKafkaPort() int {
port := os.Getenv(KafkaPort)
if port == "" {
Expand All @@ -227,7 +218,6 @@ func GetKafkaPort() int {
return p
}

// GetESAddress return the kafka address
func GetESAddress() string {
addr := os.Getenv(ESSeeds)
if addr == "" {
Expand All @@ -236,7 +226,6 @@ func GetESAddress() string {
return addr
}

// GetESPort return the Kafka port
func GetESPort() int {
port := os.Getenv(ESPort)
if port == "" {
Expand Down

0 comments on commit 99fbdd9

Please sign in to comment.