Skip to content

Commit

Permalink
tech-debt: Apply sharding to query-engine tests, retry flakes and get…
Browse files Browse the repository at this point in the history
… rid of buildjet (prisma#4593)
  • Loading branch information
Miguel Fernández authored Dec 20, 2023
1 parent 2fab2ec commit f8ac68b
Show file tree
Hide file tree
Showing 13 changed files with 353 additions and 269 deletions.
88 changes: 88 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[store]
# The directory under the workspace root at which nextest-related files are
# written. Profile-specific storage is currently written to dir/<profile-name>.
dir = "target/nextest"

# This section defines the default nextest profile. Custom profiles are layered
# on top of the default profile.
[profile.default]
# "retries" defines the number of times a test should be retried. If set to a
# non-zero value, tests that succeed on a subsequent attempt will be marked as
# flaky. Can be overridden through the `--retries` option.
# Examples
# * retries = 3
# * retries = { backoff = "fixed", count = 2, delay = "1s" }
# * retries = { backoff = "exponential", count = 10, delay = "1s", jitter = true, max-delay = "10s" }
retries = { backoff = "fixed", count = 5, delay = "1s", jitter = true }

# The number of threads to run tests with. Supported values are either an integer or
# the string "num-cpus". Can be overridden through the `--test-threads` option.
test-threads = "num-cpus"

# The number of threads required for each test. This is generally used in overrides to
# mark certain tests as heavier than others. However, it can also be set as a global parameter.
threads-required = 1

# Show these test statuses in the output.
#
# The possible values this can take are:
# * none: no output
# * fail: show failed (including exec-failed) tests
# * retry: show flaky and retried tests
# * slow: show slow tests
# * pass: show passed tests
# * skip: show skipped tests (most useful for CI)
# * all: all of the above
#
# Each value includes all the values above it; for example, "slow" includes
# failed and retried tests.
#
# Can be overridden through the `--status-level` flag.
status-level = "all"

# Similar to status-level, show these test statuses at the end of the run.
final-status-level = "flaky"

# "failure-output" defines when standard output and standard error for failing tests are produced.
# Accepted values are
# * "immediate": output failures as soon as they happen
# * "final": output failures at the end of the test run
# * "immediate-final": output failures as soon as they happen and at the end of
# the test run; combination of "immediate" and "final"
# * "never": don't output failures at all
#
# For large test suites and CI it is generally useful to use "immediate-final".
#
# Can be overridden through the `--failure-output` option.
failure-output = "immediate-final"

# "success-output" controls production of standard output and standard error on success. This should
# generally be set to "never".
success-output = "never"

# Cancel the test run on the first failure. For CI runs, consider setting this
# to false.
fail-fast = false

# Treat a test that takes longer than the configured 'period' as slow, and print a message.
# See <https://nexte.st/book/slow-tests> for more information.
#
# Optional: specify the parameter 'terminate-after' with a non-zero integer,
# which will cause slow tests to be terminated after the specified number of
# periods have passed.
# Example: slow-timeout = { period = "60s", terminate-after = 2 }
slow-timeout = { period = "60s" }

# Treat a test as leaky if after the process is shut down, standard output and standard error
# aren't closed within this duration.
#
# This usually happens in case of a test that creates a child process and lets it inherit those
# handles, but doesn't clean the child process up (especially when it fails).
#
# See <https://nexte.st/book/leaky-tests> for more information.
leak-timeout = "100ms"

# This profile is activated if MIRI_SYSROOT is set.
[profile.default-miri]
# Miri tests take up a lot of memory, so only run 1 test at a time by default.
test-threads = 1
17 changes: 8 additions & 9 deletions .github/workflows/build-prisma-schema-wasm.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
name: Build prisma-schema-wasm
name: Prisma Schema (WASM)
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/build-wasm.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- "!.github/workflows/build-prisma-schema-wasm.yml"
- ".github/**"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"

jobs:
build:
name: 'prisma-schema-wasm build ${{ github.event.ref }} for commit ${{ github.event.inputs.commit }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
name: Codspeed Benchmark
name: "QE: Codespeed benchmarks"
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/benchmark.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- ".github/**"
- "!.github/workflows/benchmark.yml"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
benchmark:
name: 'Run benchmarks on Linux'

run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -29,10 +27,10 @@ jobs:
- name: Install cargo-codspeed
run: cargo install cargo-codspeed

- name: 'Build the benchmark targets: schema'
- name: "Build the benchmark targets: schema"
run: cargo codspeed build -p schema

- name: 'Build the benchmark targets: request-handlers'
- name: "Build the benchmark targets: request-handlers"
run: cargo codspeed build -p request-handlers

- name: Run the benchmarks
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
name: Formatting
name: "All crates: linting"
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/formatting.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- ".github/**"
- "!.github/workflows/formatting.yml"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
clippy:
name: clippy linting
runs-on: ubuntu-latest
env:
RUSTFLAGS: '-Dwarnings'
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -32,7 +33,7 @@ jobs:
cargo clippy --all-features
cargo clippy --all-features -p query-engine-wasm --target wasm32-unknown-unknown
format:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -41,6 +42,7 @@ jobs:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check

shellcheck:
runs-on: ubuntu-latest
steps:
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/test-compilation.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
name: Test release binary compilation
name: "All crates: compilation"
on:
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/compilation.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- "!.github/workflows/test-compilation.yml"
- ".github/**"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test-crate-compilation:
name: 'Compile top level crates on Linux'
name: "Check release compilation"
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable

- run: 'cargo clean && cargo build --release -p schema-engine-cli'
name: 'Compile Migration Engine'
- run: "cargo clean && cargo build --release -p schema-engine-cli"
name: "Compile Migration Engine"

- run: 'cargo clean && cargo build --release -p prisma-fmt'
name: 'Compile prisma-fmt'
- run: "cargo clean && cargo build --release -p prisma-fmt"
name: "Compile prisma-fmt"

- run: 'cargo clean && cargo build --release -p query-engine'
name: 'Compile Query Engine Binary'
- run: "cargo clean && cargo build --release -p query-engine"
name: "Compile Query Engine Binary"

- run: 'cargo clean && cargo build --release -p query-engine-node-api'
name: 'Compile Query Engine Library'
- run: "cargo clean && cargo build --release -p query-engine-node-api"
name: "Compile Query Engine Library"

- name: 'Check that Cargo.lock did not change'
run: 'git diff --exit-code'
- name: "Check that Cargo.lock did not change"
run: "git diff --exit-code"
15 changes: 4 additions & 11 deletions .github/workflows/test-quaint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Test Quaint
name: "Quaint: integration tests"
on:
push:
branches:
- main
pull_request:
paths:
- 'quaint/**'

- "quaint/**"
- "!.github/workflows/test-quaint.yml"

jobs:
tests:
runs-on: ubuntu-latest
Expand All @@ -16,14 +17,6 @@ jobs:
matrix:
features:
- "--lib --features=all"
- "--lib --no-default-features --features=sqlite"
- "--lib --no-default-features --features=sqlite --features=pooled"
- "--lib --no-default-features --features=postgresql"
- "--lib --no-default-features --features=postgresql --features=pooled"
- "--lib --no-default-features --features=mysql"
- "--lib --no-default-features --features=mysql --features=pooled"
- "--lib --no-default-features --features=mssql"
- "--lib --no-default-features --features=mssql --features=pooled"
env:
TEST_MYSQL: "mysql://root:prisma@localhost:3306/prisma"
TEST_MYSQL8: "mysql://root:prisma@localhost:3307/prisma"
Expand Down
46 changes: 22 additions & 24 deletions .github/workflows/test-query-engine-black-box.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
name: Test Query Engine (Black Box)
name: "QE: black-box tests"
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/**'
- '!.github/workflows/query-engine-black-box.yml'
- '.buildkite/**'
- '*.md'
- 'LICENSE'
- 'CODEOWNERS'
- 'renovate.json'
- "!.github/workflows/test-query-engine-black-box.yml"
- ".github/**"
- ".buildkite/**"
- "*.md"
- "LICENSE"
- "CODEOWNERS"
- "renovate.json"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rust-tests:
name: 'query-engine as a black-box'

test:
strategy:
fail-fast: false
matrix:
database:
- name: 'postgres16'
- name: "postgres16"
single_threaded: false
connector: 'postgres'
connector: "postgres"
# Arbitrary PostgreSQL version
# we opted for the most recent one, there is no need to have a matrix
version: '16'
version: "16"

env:
LOG_LEVEL: 'info'
LOG_QUERIES: 'y'
RUST_LOG_FORMAT: 'devel'
RUST_BACKTRACE: '1'
CLICOLOR_FORCE: '1'
CLOSED_TX_CLEANUP: '2'
SIMPLE_TEST_MODE: '1'
QUERY_BATCH_SIZE: '10'
TEST_RUNNER: 'direct'
LOG_LEVEL: "info"
LOG_QUERIES: "y"
RUST_LOG_FORMAT: "devel"
RUST_BACKTRACE: "1"
CLICOLOR_FORCE: "1"
CLOSED_TX_CLEANUP: "2"
SIMPLE_TEST_MODE: "1"
QUERY_BATCH_SIZE: "10"
TEST_RUNNER: "direct"
TEST_CONNECTOR: ${{ matrix.database.connector }}
TEST_CONNECTOR_VERSION: ${{ matrix.database.version }}

Expand All @@ -60,7 +58,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: 'Start ${{ matrix.database.name }} (${{ matrix.engine_protocol }})'
- name: "Start ${{ matrix.database.name }} (${{ matrix.engine_protocol }})"
run: make start-${{ matrix.database.name }}

- uses: dtolnay/rust-toolchain@stable
Expand Down
Loading

0 comments on commit f8ac68b

Please sign in to comment.