Skip to content

Auto-scaling unit tests are #[ignore]d and never run in CI #491

Description

@RUKAYAT-CODER

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions