Skip to content

feat: add MySQL and Redis Wasm integration tests (US-117)#102

Merged
tervezo-ai[bot] merged 4 commits intomainfrom
feat/add-mysql-and-redis-integration-tests-fnmahr13b9v7l0ugun65s6x7
Mar 13, 2026
Merged

feat: add MySQL and Redis Wasm integration tests (US-117)#102
tervezo-ai[bot] merged 4 commits intomainfrom
feat/add-mysql-and-redis-integration-tests-fnmahr13b9v7l0ugun65s6x7

Conversation

@tervezo-ai
Copy link
Copy Markdown
Contributor

@tervezo-ai tervezo-ai bot commented Mar 13, 2026

Summary

  • New guest Wasm component (tests/fixtures/rust-mysql-redis-integration-guest/): #![no_std] cdylib that exercises MySQL wire protocol (handshake, COM_QUERY, OK/ERR/EOF parsing) and Redis RESP (SET/GET/DEL) through the generic database-proxy WIT interface
  • New integration test file (crates/warpgrid-host/tests/integration_wasm_mysql_redis.rs): 6 tests gated behind cfg(feature = "integration"):
    • test_mysql_crud_via_wasm — CREATE TABLE → INSERT → SELECT → DROP TABLE
    • test_redis_crud_via_wasm — SET → GET → DEL
    • test_mysql_pool_reuse_via_wasm — connect, query, close, reconnect, query (proves pool reuse)
    • test_redis_pool_reuse_via_wasm — connect, SET, close, reconnect, GET (proves pool reuse)
    • test_mysql_health_check_removes_dead — COM_PING detects dead MySQL connections
    • test_redis_health_check_removes_dead — PING detects dead Redis connections
  • StatefulMockMysqlServer: SQL-aware query dispatch with state tracking (tables + rows)
  • StatefulMockRedisServer: RESP protocol with HashMap key-value state
  • Feature flag: integration = [] in crates/warpgrid-host/Cargo.toml
  • Fix: Added missing WIT directory for rust-http-redis-postgres-guest fixture (US-703)
  • Fix: Added missing wat workspace dependency in root Cargo.toml

Test plan

  • cargo check -p warpgrid-host passes
  • cargo test -p warpgrid-host --test integration_mysql --test integration_redis — 22 existing tests pass
  • cargo test -p warpgrid-host --test integration_wasm_mysql_redis — 0 tests (correctly gated)
  • cargo test -p warpgrid-host --features integration --test integration_wasm_mysql_redis — all 6 pass
  • cargo clippy -p warpgrid-host --features integration --test integration_wasm_mysql_redis — 0 warnings

🤖 Generated with Claude Code


View implementation in Tervezo

nadilas and others added 4 commits March 13, 2026 18:51
Add [features] section with integration = [] to warpgrid-host Cargo.toml
for gating MySQL and Redis integration tests. Also fix pre-existing
missing `wat` workspace dependency in root Cargo.toml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create wit/test.wit, wit/deps/shim/database-proxy.wit, and
wit/deps/shim/dns.wit for the existing US-703 guest fixture that
was missing its WIT directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create tests/fixtures/rust-mysql-redis-integration-guest/ with:
- Cargo.toml (cdylib, wit-bindgen 0.42, dlmalloc)
- WIT world definition with 4 exported test functions
- Full lib.rs implementing MySQL wire protocol helpers (handshake,
  COM_QUERY, OK/ERR/EOF parsing, length-encoded strings) and Redis
  RESP helpers (command builder, bulk string parser)

Exports: test-mysql-crud, test-redis-crud, test-mysql-pool-reuse,
test-redis-pool-reuse — all exercising raw protocol bytes through
the database-proxy WIT interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement end-to-end integration tests proving Wasm guest components
can communicate with MySQL and Redis through WarpGrid's database proxy.

New test file: integration_wasm_mysql_redis.rs (gated behind
cfg(feature = "integration")) with 6 tests:

- test_mysql_crud_via_wasm: CREATE TABLE → INSERT → SELECT → DROP TABLE
- test_redis_crud_via_wasm: SET → GET → DEL
- test_mysql_pool_reuse_via_wasm: connect → query → close → reconnect → query
- test_redis_pool_reuse_via_wasm: connect → SET → close → reconnect → GET
- test_mysql_health_check_removes_dead: COM_PING detects dead connections
- test_redis_health_check_removes_dead: PING detects dead connections

Includes StatefulMockMysqlServer (SQL-aware query dispatch with state
tracking) and StatefulMockRedisServer (RESP protocol with HashMap
key-value state). All clippy warnings resolved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tervezo-ai tervezo-ai bot merged commit 05f6266 into main Mar 13, 2026
3 of 10 checks passed
tervezo-ai bot pushed a commit that referenced this pull request Mar 13, 2026
Reviewed and merged 6 PRs, closed 1 as superseded:
- PR #103: fix schedule script URL prefix and non-JSON responses
- PR #1: wasmtime 41.0.3 → 41.0.4 security bump
- PR #99: Postgres database proxy integration tests (US-114)
- PR #101: signal handling integration tests (US-110)
- PR #104: threading model declaration host function (US-118)
- PR #102: MySQL and Redis Wasm integration tests (US-117)
- PR #100: closed as superseded by #103

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant