Skip to content

Add firewall negative integration tests for control-plane validation - #333

Open
shivamp6265 wants to merge 4 commits into
au-ts:mainfrom
shivamp6265:main
Open

Add firewall negative integration tests for control-plane validation#333
shivamp6265 wants to merge 4 commits into
au-ts:mainfrom
shivamp6265:main

Conversation

@shivamp6265

Copy link
Copy Markdown

Summary

Add comprehensive end-to-end negative integration tests for the LionsOS firewall control plane. The test suite validates the HTTP API's rejection of invalid requests and ensures firewall state remains unchanged when errors occur.

Problem

The firewall's Docker runtime test suite (autotest.sh) provides good coverage of successful operations (traffic flows, rule application, route addition/removal). However, it lacks coverage of error paths and negative cases:

  • Invalid interface indices
  • Malformed or incomplete payloads
  • Duplicate rules and routes
  • Non-existent resource deletions
  • Invalid protocol strings

This leaves critical input-validation code paths untested and creates regression risk when modifying the firewall's API layer or firewall services.

Solution

Add negative_tests.sh, a standalone shell script that:

  1. Tests invalid requests against all major control-plane endpoints
  2. Verifies the API returns appropriate error responses
  3. Asserts that firewall state (route/rule counts, configuration) is unchanged
  4. Cleans up any transient test state
  5. Works within the existing Docker/QEMU firewall testing harness

Testing

The script can be run inside the firewall test container:

cd examples/firewall/docker
docker build -t lionsos-firewall .
docker run -it --rm -v $(pwd):/lionsos lionsos-firewall bash

# Inside container:
cd /lionsos/examples/firewall/docker
bash scripts/firewall_configuration.sh
bash scripts/building_running.sh &
sleep 10
bash scripts/negative_tests.sh

Files Changed

•  examples/firewall/docker/scripts/negative_tests.sh  (new, 142 lines)

Addresses

Closes #277

Add comprehensive end-to-end negative integration tests to validate the
firewall's control-plane error handling...

Signed-off-by: Shivam Patel <shivam@Shivams-MacBook-Pro.local>
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