Skip to content

Commit

Permalink
test: Enabled MySQL database (#3318)
Browse files Browse the repository at this point in the history
* test: Enabled MySQL database

* Remove invalid unique constraint

* Fix schema, expect another error

* Fix last test
  • Loading branch information
kyleconroy committed Apr 4, 2024
1 parent fd91deb commit e8405b5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 82 deletions.
62 changes: 1 addition & 61 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,72 +10,12 @@ services:
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_ROOT_HOST: '%'

mysql5:
image: "mysql/mysql-server:5.7"
ports:
- "3305:3306"
restart: always
environment:
MYSQL_DATABASE: dinotest
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_ROOT_HOST: '%'
profiles:
- mysql

postgresql:
image: "postgres:15"
image: "postgres:16"
ports:
- "5432:5432"
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_USER: postgres

postgresql14:
image: "postgres:14"
ports:
- "5414:5432"
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_USER: postgres
profiles:
- postgres

postgresql13:
image: "postgres:13"
ports:
- "5413:5432"
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_USER: postgres
profiles:
- postgres

postgresql12:
image: "postgres:12"
ports:
- "5412:5432"
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_USER: postgres
profiles:
- postgres

postgresql11:
image: "postgres:11"
ports:
- "5411:5432"
restart: always
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_USER: postgres
profiles:
- postgres
16 changes: 8 additions & 8 deletions internal/endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ func TestReplay(t *testing.T) {
c.SQL[i].Database = &config.Database{
URI: uri,
}
// case config.EngineMySQL:
// uri := local.MySQL(t, files)
// c.SQL[i].Database = &config.Database{
// URI: uri,
// }
case config.EngineMySQL:
uri := local.MySQL(t, files)
c.SQL[i].Database = &config.Database{
URI: uri,
}
default:
// pass
}
Expand All @@ -146,9 +146,9 @@ func TestReplay(t *testing.T) {
if len(os.Getenv("POSTGRESQL_SERVER_URI")) == 0 {
return false
}
// if len(os.Getenv("MYSQL_SERVER_URI")) == 0 {
// return false
// }
if len(os.Getenv("MYSQL_SERVER_URI")) == 0 {
return false
}
return true
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
CREATE TABLE authors (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name text NOT NULL,
bio text,
UNIQUE(name)
);

-- name: ListAuthors :many
SELECT *
FROM authors
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE authors (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name text NOT NULL,
bio text
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"path": "go",
"engine": "mysql",
"name": "querytest",
"schema": "query.sql",
"schema": "schema.sql",
"queries": "query.sql"
}
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# package querytest
query.sql:11:10: column reference "invalid_reference" not found
query.sql:4:10: column reference "invalid_reference" not found
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
CREATE TABLE authors (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(10) NOT NULL,
bio text,
UNIQUE(name)
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(10) NOT NULL,
bio text
);

CREATE TABLE IF NOT EXISTS weather_metrics
Expand Down

0 comments on commit e8405b5

Please sign in to comment.