Skip to content

Commit d23077d

Browse files
committed
refactor(tasks): flatten test tasks into mise.toml
Simplifies test task structure by moving task definitions into main mise.toml with shell scripts for flag handling. Changes: - Create tasks/test.sh with MISE USAGE for --postgres flag - Move test:legacy, test:sqlx tasks to mise.toml - Remove tasks/rust.toml (moved to mise.toml) - Update mise.toml includes (remove rust.toml, test.toml) Structure: mise.toml (task definitions) ├─ test → tasks/test.sh (accepts --postgres flag) ├─ test:legacy → tasks/test-legacy.sh (accepts --postgres flag) └─ test:sqlx → inline script CI compatibility: ✓ Accepts --postgres flag: mise run test --postgres ${VERSION} ✓ Shell scripts handle MISE USAGE flags correctly ✓ Simpler structure (test.toml removed, merged into mise.toml)
1 parent 3935a3a commit d23077d

File tree

4 files changed

+35
-33
lines changed

4 files changed

+35
-33
lines changed

mise.toml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
# "./tests/mise.tls.toml",
88
# ]
99
[task_config]
10-
includes = ["tasks", "tasks/postgres.toml", "tasks/rust.toml", "tasks/test.toml"]
10+
includes = [
11+
"tasks",
12+
"tasks/postgres.toml",
13+
]
1114

1215
[env]
1316
POSTGRES_DB = "cipherstash"
@@ -27,4 +30,34 @@ run = """
2730
[tasks."test"]
2831
description = "Run all tests (legacy SQL + SQLx Rust)"
2932
sources = ["src/**/*_test.sql", "tests/**/*.sql", "tests/sqlx/**/*.rs"]
30-
run = "{{config_root}}/tasks/test-all.sh"
33+
run = "{{config_root}}/tasks/test.sh"
34+
35+
[tasks."test:legacy"]
36+
description = "Run legacy SQL tests (inline test files)"
37+
sources = ["src/**/*_test.sql", "tests/*.sql"]
38+
run = "{{config_root}}/tasks/test-legacy.sh"
39+
40+
[tasks."test:sqlx"]
41+
description = "Run SQLx tests with hybrid migration approach"
42+
dir = "{{config_root}}"
43+
env = { DATABASE_URL = "postgresql://{{get_env(name='POSTGRES_USER', default='cipherstash')}}:{{get_env(name='POSTGRES_PASSWORD', default='password')}}@{{get_env(name='POSTGRES_HOST', default='localhost')}}:{{get_env(name='POSTGRES_PORT', default='7432')}}/{{get_env(name='POSTGRES_DB', default='cipherstash')}}" }
44+
run = """
45+
# Copy built SQL to SQLx migrations (EQL install is generated, not static)
46+
echo "Updating SQLx migrations with built EQL..."
47+
cp release/cipherstash-encrypt.sql tests/sqlx/migrations/001_install_eql.sql
48+
49+
# Run SQLx migrations and tests
50+
echo "Running SQLx migrations..."
51+
cd tests/sqlx
52+
sqlx migrate run
53+
54+
echo "Running Rust tests..."
55+
cargo test
56+
"""
57+
58+
[tasks."test:sqlx:watch"]
59+
description = "Run SQLx tests in watch mode (rebuild EQL on changes)"
60+
dir = "{{config_root}}/tests/sqlx"
61+
run = """
62+
cargo watch -x test
63+
"""

tasks/rust.toml

Lines changed: 0 additions & 24 deletions
This file was deleted.
File renamed without changes.

tasks/test.toml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)