Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 2 additions & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,14 @@ jobs:
needs: determine_frameworks

services:
mysql57:
image: mysql:5.7
ports:
- 33576:3306
env:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=5
mysql80:
image: mysql:8.0
ports:
- 33578:3306
env:
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=5
vttestserver57:
image: vitess/vttestserver:mysql57
ports:
- 33577:33577
env:
PORT: 33574
KEYSPACES: test
NUM_SHARDS: "1"
MYSQL_BIND_HOST: "0.0.0.0"
options: --health-cmd="mysqladmin ping -h127.0.0.1 -P33577" --health-interval=5s --health-timeout=2s --health-retries=5
vttestserver80:
image: vitess/vttestserver:mysql80
ports:
- 33807:33807
env:
PORT: 33804
KEYSPACES: test
NUM_SHARDS: "1"
KEYSPACES: test,tests
NUM_SHARDS: "1,1"
MYSQL_BIND_HOST: "0.0.0.0"
options: --health-cmd="mysqladmin ping -h127.0.0.1 -P33807" --health-interval=5s --health-timeout=2s --health-retries=5

Expand All @@ -79,36 +53,6 @@ jobs:
name: Build changed tests
run: ./run.sh build_image "${{ matrix.framework }}"

- id: run-mysql57
name: Run changed tests against upstream MySQL 5.7
run: ./run.sh run_test "${{ matrix.framework }}"
env:
VT_USERNAME: root
VT_PASSWORD: root
VT_DATABASE: test
VT_HOST: 127.0.0.1
VT_PORT: 33576

- id: run-mysql80
name: Run changed tests against upstream MySQL 8.0
run: ./run.sh run_test "${{ matrix.framework }}"
env:
VT_USERNAME: root
VT_PASSWORD: root
VT_DATABASE: test
VT_HOST: 127.0.0.1
VT_PORT: 33578

- id: run-vttestserver57
name: Run changed tests against vttestserver:mysql57
run: ./run.sh run_test "${{ matrix.framework }}"
env:
VT_USERNAME: test
VT_PASSWORD: test
VT_DATABASE: test
VT_HOST: 127.0.0.1
VT_PORT: 33577

- id: run-vttestserver80
name: Run changed tests against vttestserver:mysql80
run: ./run.sh run_test "${{ matrix.framework }}"
Expand Down
23 changes: 23 additions & 0 deletions frameworks/javascript/prisma/hacks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,26 @@ index 2a1d7a85..a21f66fe 100644
const credentials = uriToCredentials(connectionString)

return {
diff --git a/src/packages/client/src/utils/setupMysql.ts b/src/packages/client/src/utils/setupMysql.ts
index 55b99f0ce..d2b0b3da4 100644
--- a/src/packages/client/src/utils/setupMysql.ts
+++ b/src/packages/client/src/utils/setupMysql.ts
@@ -44,8 +44,15 @@ export async function tearDownMysql(connectionString: string) {
multipleStatements: true,
})

- await db.query(`
- DROP DATABASE IF EXISTS \`${credentials.database}\`;
- `)
+
+ await db.query("USE " + credentials.database);
+ const foreign_keys = await db.query({rowsAsArray: true, sql: "SELECT DISTINCT TABLE_NAME, CONSTRAINT_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME IS NOT NULL"});
+ for(let row of foreign_keys) {
+ await db.query("ALTER TABLE `" + row[0] + "` DROP FOREIGN KEY `" + row[1] + "`");
+ }
+ const tables = await db.query({rowsAsArray: true, sql: "SHOW TABLES"});
+ for(let row of tables) {
+ await db.query("DROP TABLE `" + row[0] + "`");
+ }
await db.end()
}
11 changes: 9 additions & 2 deletions frameworks/javascript/prisma/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export TEST_MYSQL_URI="${TEST_MYSQL_BASE_URI}/${VT_DATABASE}?sslmode=false";
export TEST_MARIADB_BASE_URL="${TEST_MYSQL_BASE_URI}";
export TEST_MARIADB_URI="${TEST_MYSQL_URI}";

timeout 3m pnpm run jest integration/mysql -- --detectOpenHandles --maxConcurrency=1;
timeout 3m pnpm run jest integration/mariadb -- --detectOpenHandles --maxConcurrency=1;
timeout 3m pnpm run jest integration/mysql -- --detectOpenHandles --maxConcurrency=1 || true;
timeout 3m pnpm run jest integration/mariadb -- --detectOpenHandles --maxConcurrency=1 || true;

# Client Tests

cd ../client

export TEST_MYSQL_ISOLATED_URI="${TEST_MYSQL_URI}";

timeout 10m pnpm run test -- --detectOpenHandles --testPathIgnorePatterns src/__tests__/types/types.test.ts || true;