diff --git a/.gitignore b/.gitignore index 975e10cb22..b566459860 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ tmp/ # operating system artifacts .DS_Store + +# test mysql server data +mysqldata/ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 11ac440869..de0ba26f72 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/server/datastore/mysql_test.go b/server/datastore/mysql_test.go index 3b15e226c3..ef8cf4dc3a 100644 --- a/server/datastore/mysql_test.go +++ b/server/datastore/mysql_test.go @@ -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" }