Browse Source

Go tests were not connecting to the DB

msmith-techempower 10 years ago
parent
commit
943bde00fd

+ 2 - 0
frameworks/Go/beego/setup.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/hello/hello.go
+
 # Where to find the go executable
 export PATH="$GOROOT/bin:$PATH"
 

+ 1 - 2
frameworks/Go/falcore/setup.sh

@@ -1,7 +1,6 @@
 #!/bin/bash
 
-
-#!/bin/bash
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/framework_benchmarks/falcore.go
 
 # Where to find the go executable
 export PATH="$GOROOT/bin:$PATH"

+ 1 - 4
frameworks/Go/gin/hello.go

@@ -149,10 +149,7 @@ func init() {
 	runtime.GOMAXPROCS(runtime.NumCPU())
 
 	dsn := "benchmarkdbuser:benchmarkdbpass@tcp(%s:3306)/hello_world"
-	dbhost := os.Getenv("TFB_DATABASE_HOST")
-	if dbhost == "" {
-		dbhost = "localhost"
-	}
+	dbhost := os.Getenv("DBHOST")
 
 	db, err := sql.Open("mysql", fmt.Sprintf(dsn, dbhost))
 	if err != nil {

+ 2 - 0
frameworks/Go/go/setup.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/hello/hello.go
+
 # Where to find the go executable
 export PATH="$GOROOT/bin:$PATH"
 

+ 2 - 0
frameworks/Go/gorail/setup.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/hello/hello.go
+
 # Where to find the go executable
 export PATH="$GOROOT/bin:$PATH"
 

+ 2 - 0
frameworks/Go/revel-jet/setup.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/benchmark/conf/app.conf
+
 # here te find the go executable
 export PATH="$GOROOT/bin:$PATH"
 

+ 2 - 0
frameworks/Go/revel-qbs/setup.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/benchmark/conf/app.conf
+
 # Where to find the go executable
 export PATH="$GOROOT/bin:$PATH"
 

+ 2 - 0
frameworks/Go/revel/setup.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/benchmark/conf/app.conf
+
 # Where to find the go executable
 export PATH="$GOROOT/bin:$PATH"