-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1187 from ruflin/mb-mysql-auth
Add authentication for mysql
- Loading branch information
Showing
13 changed files
with
165 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Helper functions for testing used in the apache metricsets | ||
*/ | ||
package apache | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func GetApacheEnvHost() string { | ||
host := os.Getenv("APACHE_HOST") | ||
|
||
if len(host) == 0 { | ||
host = "127.0.0.1" | ||
} | ||
return host | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// +build integration | ||
|
||
package mysql | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestConnect(t *testing.T) { | ||
|
||
db, err := Connect(GetMySQLEnvDSN()) | ||
assert.NoError(t, err) | ||
|
||
err = db.Ping() | ||
assert.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Helper functions for testing used in the mysql metricsets | ||
*/ | ||
package mysql | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func GetMySQLEnvDSN() string { | ||
dsn := os.Getenv("MYSQL_DSN") | ||
|
||
if len(dsn) == 0 { | ||
dsn = CreateDSN("tcp(127.0.0.1:3306)/", "root", "") | ||
} | ||
return dsn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Helper functions for testing used in the redis metricsets | ||
*/ | ||
package redis | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func GetRedisEnvHost() string { | ||
host := os.Getenv("REDIS_HOST") | ||
|
||
if len(host) == 0 { | ||
host = "127.0.0.1" | ||
} | ||
return host | ||
} | ||
|
||
func GetRedisEnvPort() string { | ||
port := os.Getenv("REDIS_PORT") | ||
|
||
if len(port) == 0 { | ||
port = "6379" | ||
} | ||
return port | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters