Module helper_binary

Module helper_binary 

Source
Expand description

Helper binary management for cross-process tests.

This module provides utilities for locating and using pre-built helper binaries in cross-process tests. When RAPACE_PREBUILT_HELPERS is set, tests will only use pre-built binaries and fail immediately if they’re missing.

§Environment Variables

  • RAPACE_PREBUILT_HELPERS: When set to 1 or true, enforce that helper binaries must be pre-built (skip inline building). Tests will panic if binaries are not found. This ensures tests don’t rebuild binaries during execution.

§Usage

In your cross-process test:

use rapace_testkit::helper_binary::find_helper_binary;

#[tokio::test]
async fn test_my_service() {
    // Find the helper binary (will fail fast if not pre-built and RAPACE_PREBUILT_HELPERS is set)
    let helper_path = find_helper_binary("my-helper").unwrap();

    // Spawn the helper
    let mut helper = Command::new(&helper_path)
        .args(&["--transport=stream", "--addr=127.0.0.1:9000"])
        .spawn()
        .expect("failed to spawn helper");

    // ... test logic ...
}

Functions§

enforce_prebuilt_helpers
Check if pre-built helpers are enforced via environment variable.
find_helper_binary
Find a pre-built helper binary in the target directory.