Background
auto_scaling.rs (added to implement issue #322, automatic scaling for high-load scenarios) has three unit tests marked #[ignore]:
#[test]
#[ignore] // TODO: Fix test - requires proper contract context setup
fn test_batch_size_scaling() { ... }
#[test]
#[ignore] // TODO: Fix test - requires proper contract context setup
fn test_load_shedding_priority() { ... }
#[test]
#[ignore] // TODO: Fix test - requires proper contract context setup
fn test_gas_allocation_priority() { ... }
These tests already contain real assertions (batch size scaling under load, shedding priority, gas allocation priority) but are excluded from normal cargo test runs, so the auto-scaling logic that the system relies on under high load has no active regression coverage — a change that broke load shedding or batch sizing would not be caught.
Implementation Plan
- Determine the correct
env.as_contract(...) / storage-initialization pattern needed so AutoScaler::initialize and subsequent calls run in a valid contract context inside these tests.
- Remove the
#[ignore] attribute from each of the three tests once fixed.
- Extend
test_load_shedding_priority to actually set up high-load metrics and assert low-priority operations are shed (the TODO comment in the test body notes this is currently missing).
- Confirm
cargo test -p teachlink-contract auto_scaling --features testutils runs all three tests without --ignored.
Acceptance Criteria
- All three auto-scaling tests run by default (no
#[ignore])
test_load_shedding_priority asserts actual shedding behavior under high load, not just the critical-priority exemption
cargo test passes with the tests enabled
Background
auto_scaling.rs(added to implement issue #322, automatic scaling for high-load scenarios) has three unit tests marked#[ignore]:These tests already contain real assertions (batch size scaling under load, shedding priority, gas allocation priority) but are excluded from normal
cargo testruns, so the auto-scaling logic that the system relies on under high load has no active regression coverage — a change that broke load shedding or batch sizing would not be caught.Implementation Plan
env.as_contract(...)/ storage-initialization pattern needed soAutoScaler::initializeand subsequent calls run in a valid contract context inside these tests.#[ignore]attribute from each of the three tests once fixed.test_load_shedding_priorityto actually set up high-load metrics and assert low-priority operations are shed (the TODO comment in the test body notes this is currently missing).cargo test -p teachlink-contract auto_scaling --features testutilsruns all three tests without--ignored.Acceptance Criteria
#[ignore])test_load_shedding_priorityasserts actual shedding behavior under high load, not just the critical-priority exemptioncargo testpasses with the tests enabled