Use persistent MySQL for local server, tmpfs MySQL for tests (#1245)

This commit is contained in:
Zachary Wasserman
2017-02-17 09:15:10 -08:00
committed by GitHub
parent 9ecff79da9
commit c0d87cb69a
3 changed files with 20 additions and 2 deletions
+3
View File
@@ -21,3 +21,6 @@ tmp/
# operating system artifacts
.DS_Store
# test mysql server data
mysqldata/
+14 -1
View File
@@ -1,6 +1,19 @@
version: '2'
services:
mysql:
image: mysql:5.7
volumes:
- .:/tmp
command: mysqld --datadir=/tmp/mysqldata
environment:
MYSQL_ROOT_PASSWORD: toor
MYSQL_DATABASE: kolide
MYSQL_USER: kolide
MYSQL_PASSWORD: kolide
ports:
- "3306:3306"
mysql_test:
image: mysql:5.7
command: mysqld --datadir=/tmpfs
tmpfs: /tmpfs
@@ -10,7 +23,7 @@ services:
MYSQL_USER: kolide
MYSQL_PASSWORD: kolide
ports:
- "3306:3306"
- "3307:3306"
mailhog:
image: mailhog/mailhog:latest
+3 -1
View File
@@ -17,9 +17,11 @@ func setupMySQL(t *testing.T) (ds *mysql.Datastore, teardown func()) {
Username: "kolide",
Password: "kolide",
Database: "kolide",
Address: "127.0.0.1:3306",
// When using docker-compose.yml for local testing
Address: "127.0.0.1:3307",
}
// When using Docker link on CI
if h, ok := os.LookupEnv("MYSQL_PORT_3306_TCP_ADDR"); ok {
config.Address = h + ":3306"
}