Add fault injection code in tests #70

Open
opened 2026-01-16 15:29:27 +00:00 by jabber.developer2 · 0 comments
Collaborator

Summary

Add infrastructure for fault injection testing to verify that tests correctly detect failures and CI pipeline properly reports them.

Motivation

Currently there's no automated way to verify that:

  1. Unit tests actually fail when expected behavior is broken
  2. CI pipeline correctly reports test failures
  3. Docker images are properly rebuilt when dependencies change (e.g., cmocka 2.0 breaking changes)

We discovered this gap when testing cmocka 2.0 compatibility - cached Docker images masked the actual test failures.

Proposed Solution

  1. Test failure injection mode

    • Add --inject-fault flag to test runner
    • Introduce deliberate assertion failures to verify test harness
    • Example: make check INJECT_FAULT=1 should always fail
  2. CI verification job

    • Periodic job that runs fault injection tests
    • Verifies CI correctly detects and reports failures
    • Alerts if "expected failures" pass (indicating broken test detection)
  3. Docker cache invalidation strategy

    • Scheduled weekly builds with --no-cache
    • Or cache key based on dependency versions
    • Ensures fresh base images with latest packages

Implementation Ideas

# In Makefile.am
if INJECT_FAULT
AM_CPPFLAGS += -DINJECT_TEST_FAULT
endif
// In test file
#ifdef INJECT_TEST_FAULT
assert_true(false && "Deliberate fault injection - this test should fail");
#endif

Acceptance Criteria

  • make check INJECT_FAULT=1 fails with clear error message
  • CI job for fault injection runs weekly
  • Documentation for fault injection testing
  • Docker images rebuilt periodically without cache
  • cmocka 2.0 compatibility issue (tests passed due to cached images)
  • PR #68 - parallel functional tests optimization
  • partially addressed by #72

Labels

testing, ci/cd, enhancement

### Summary Add infrastructure for fault injection testing to verify that tests correctly detect failures and CI pipeline properly reports them. ### Motivation Currently there's no automated way to verify that: 1. Unit tests actually fail when expected behavior is broken 2. CI pipeline correctly reports test failures 3. Docker images are properly rebuilt when dependencies change (e.g., cmocka 2.0 breaking changes) We discovered this gap when testing cmocka 2.0 compatibility - cached Docker images masked the actual test failures. ### Proposed Solution 1. **Test failure injection mode** - Add `--inject-fault` flag to test runner - Introduce deliberate assertion failures to verify test harness - Example: `make check INJECT_FAULT=1` should always fail 2. **CI verification job** - Periodic job that runs fault injection tests - Verifies CI correctly detects and reports failures - Alerts if "expected failures" pass (indicating broken test detection) 3. **Docker cache invalidation strategy** - Scheduled weekly builds with `--no-cache` - Or cache key based on dependency versions - Ensures fresh base images with latest packages ### Implementation Ideas ```makefile # In Makefile.am if INJECT_FAULT AM_CPPFLAGS += -DINJECT_TEST_FAULT endif ``` ```c // In test file #ifdef INJECT_TEST_FAULT assert_true(false && "Deliberate fault injection - this test should fail"); #endif ``` ### Acceptance Criteria - [ ] `make check INJECT_FAULT=1` fails with clear error message - [ ] CI job for fault injection runs weekly - [ ] Documentation for fault injection testing - [ ] Docker images rebuilt periodically without cache ### Related - cmocka 2.0 compatibility issue (tests passed due to cached images) - PR #68 - parallel functional tests optimization - partially addressed by #72 ### Labels `testing`, `ci/cd`, `enhancement`
jabber.developer2 added the
Kind/Testing
label 2026-01-16 15:29:27 +00:00
jabber.developer2 added this to the Plans (2025-2026) project 2026-01-16 15:29:27 +00:00
jabber.developer moved this to In Progress in Plans (2025-2026) on 2026-01-16 15:29:45 +00:00
jabber.developer2 changed title from Add fault injection testing infrastructure to Add fault injection code in tests 2026-01-21 15:51:43 +00:00
jabber.developer moved this to To Do in Plans (2025-2026) on 2026-01-21 15:56:12 +00:00
jabber.developer added the
Priority
Low
4
Reviewed
Confirmed
1
labels 2026-01-21 17:13:27 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devs/cproof#70
No description provided.