-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: run query engine tests with query compiler
Closes: https://linear.app/prisma-company/issue/ORM-555/make-prisma-engines-tests-run-with-query-compiler Co-authored-by: jacek-prisma <malec@prisma.io>
- Loading branch information
1 parent
7e7c9b8
commit 846771f
Showing
31 changed files
with
2,340 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: "QC: integration tests" | ||
on: | ||
workflow_call: | ||
inputs: | ||
setup_task: | ||
type: string | ||
required: true | ||
ignored_tests_list: | ||
type: string | ||
required: true | ||
should_fail_tests_list: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
rust-query-engine-tests: | ||
name: "${{ matrix.partition }}" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node_version: ["20"] | ||
partition: ["1/4", "2/4", "3/4", "4/4"] | ||
env: | ||
LOG_LEVEL: "info" # Set to "debug" to trace the node process running the driver adapter | ||
LOG_QUERIES: "y" | ||
RUST_LOG: "info" | ||
RUST_LOG_FORMAT: "devel" | ||
RUST_BACKTRACE: "1" | ||
CLICOLOR_FORCE: "1" | ||
CLOSED_TX_CLEANUP: "2" | ||
SIMPLE_TEST_MODE: "1" | ||
QUERY_BATCH_SIZE: "10" | ||
WASM_BUILD_PROFILE: "profiling" # Include debug info for proper backtraces | ||
WORKSPACE_ROOT: ${{ github.workspace }} | ||
IGNORED_TESTS: ${{ inputs.ignored_tests_list }} | ||
SHOULD_FAIL_TESTS: ${{ inputs.should_fail_tests_list }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# using head ref rather than merge branch to get original commit message | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: "Setup Node.js" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
|
||
- name: "Setup pnpm" | ||
uses: pnpm/action-setup@v4.0.0 | ||
with: | ||
version: 9 | ||
|
||
- name: "Login to Docker Hub" | ||
uses: docker/login-action@v3 | ||
continue-on-error: true | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
if: "${{ env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != '' }}" | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Cache Docker images. | ||
uses: ScribeMD/docker-cache@0.5.0 | ||
with: | ||
key: docker-${{ inputs.setup_task }}-${{hashFiles('docker-compose.yaml')}} | ||
|
||
- name: Extract Branch Name | ||
id: extract-branch | ||
run: | | ||
echo "Extracting branch name from: $(git show -s --format=%s)" | ||
branch="$(git show -s --format=%s | grep -o "DRIVER_ADAPTERS_BRANCH=[^ ]*" | cut -f2 -d=)" | ||
echo "branch=$branch" | ||
if [ -n "$branch" ]; then | ||
echo "Using $branch branch of driver adapters" | ||
echo "DRIVER_ADAPTERS_BRANCH=$branch" >> "$GITHUB_ENV" | ||
fi | ||
- uses: ./.github/workflows/include/rust-wasm-setup | ||
- uses: taiki-e/install-action@nextest | ||
|
||
- name: Setup | ||
env: | ||
SETUP_TASK: ${{ inputs.setup_task }} | ||
run: make "$SETUP_TASK" | ||
|
||
- name: "Run tests" | ||
env: | ||
PARTITION: ${{ matrix.partition }} | ||
run: cargo nextest run --package query-engine-tests --partition hash:"$PARTITION" |
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,36 @@ | ||
name: "QC" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
paths-ignore: | ||
- "!.github/workflows/test-query-compiler.yml" | ||
- "!.github/workflows/test-query-compiler-template.yml" | ||
- ".github/**" | ||
- ".buildkite/**" | ||
- "*.md" | ||
- "LICENSE" | ||
- "CODEOWNERS" | ||
- "renovate.json" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
qe-tests-with-qc: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
adapter: | ||
- name: pg | ||
setup_task: dev-pg-qc | ||
ignored_tests_list: query-compiler/query-engine-tests-todo/pg/timeout | ||
should_fail_tests_list: query-compiler/query-engine-tests-todo/pg/fail | ||
name: ${{ matrix.adapter.name }} | ||
uses: ./.github/workflows/test-query-compiler-template.yml | ||
with: | ||
setup_task: ${{ matrix.adapter.setup_task }} | ||
ignored_tests_list: ${{ matrix.adapter.ignored_tests_list }} | ||
should_fail_tests_list: ${{ matrix.adapter.should_fail_tests_list }} |
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,3 @@ | ||
tabWidth = 2 | ||
semi = false | ||
singleQuote = true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
#!/usr/bin/env bash | ||
node "$(dirname "${BASH_SOURCE[0]}")/../dist/qc-test-runner.js" |
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,41 @@ | ||
type GlobalWithPanicHandler = typeof globalThis & { | ||
PRISMA_WASM_PANIC_REGISTRY: { | ||
set_message?: (message: string) => void | ||
} | ||
} | ||
|
||
const global = globalThis as GlobalWithPanicHandler | ||
|
||
export function setupDefaultPanicHandler() { | ||
global.PRISMA_WASM_PANIC_REGISTRY = { | ||
set_message(message: string) { | ||
throw new PanicError(message) | ||
}, | ||
} | ||
} | ||
|
||
export function withLocalPanicHandler<T>(fn: () => T): T { | ||
const previousHandler = global.PRISMA_WASM_PANIC_REGISTRY.set_message | ||
let panic: string | undefined = undefined | ||
|
||
global.PRISMA_WASM_PANIC_REGISTRY.set_message = (message) => { | ||
panic = message | ||
} | ||
|
||
try { | ||
return fn() | ||
} finally { | ||
global.PRISMA_WASM_PANIC_REGISTRY.set_message = previousHandler | ||
|
||
if (panic) { | ||
throw new PanicError(panic) | ||
} | ||
} | ||
} | ||
|
||
export class PanicError extends Error { | ||
constructor(message: string) { | ||
super('Panic in WASM module: ' + message) | ||
this.name = 'PanicError' | ||
} | ||
} |
Oops, something went wrong.