We welcome contributions to the Azazel-Edge project! This document provides guidelines for developers who want to contribute code, documentation, or bug reports.
- Raspberry Pi OS (64-bit) or compatible Debian-based system
- Python 3.8+
- Git
-
Clone the repository:
git clone https://github.com/01rabbit/Azazel-Edge.git cd Azazel-Edge -
Install development dependencies:
# Install test dependencies pip3 install pytest pytest-cov pyyaml requests rich # Or install with optional test dependencies pip3 install -e ".[test]"
-
Verify installation:
python3 -c "import azazel_edge; print('Import successful')"
The test suite is organized under tests/ with the following structure:
tests/conftest.py- Test configuration and fixturestests/core/- Core functionality teststests/monitor/- Monitoring component teststests/utils/- Utility function tests
# Run all tests
python3 -m pytest
# Run tests with coverage report
python3 -m pytest --cov=azazel_edge
# Run specific test modules
python3 -m pytest tests/core/test_state_machine.py
# Run tests with verbose output
python3 -m pytest -v
# Run tests matching a pattern
python3 -m pytest -k "test_config"The project includes a Makefile for common development tasks:
# Run linting checks
make lint
# Run test suite
make test
# Create distribution package
make packageTests are configured via pytest.ini and pyproject.toml:
- Test discovery:
test_*.pyfiles - Coverage target:
azazel_edgemodule - Markers:
unit,integration,slow
Common fixtures are available in conftest.py:
temp_config_dir- Temporary directory for test configsmock_notify_yaml- Mock notification configurationmock_azazel_yaml- Mock main configuration
def test_example_function(mock_azazel_yaml):
"""Test description following pytest conventions."""
# Arrange
config = AzazelConfig.from_file(mock_azazel_yaml)
# Act
result = example_function(config)
# Assert
assert result.status == "expected_value"Use pytest markers to categorize tests:
import pytest
@pytest.mark.unit
def test_unit_function():
"""Fast, isolated unit test."""
pass
@pytest.mark.integration
def test_integration_scenario():
"""Integration test with external dependencies."""
pass
@pytest.mark.slow
def test_slow_operation():
"""Test that takes significant time to run."""
passThe project uses several linting tools:
- shellcheck for shell scripts
- JSON validation for configuration schemas
- File existence checks for critical scripts
Run linting before submitting:
make lint- Follow PEP 8 for Python code
- Use type hints where appropriate
- Write docstrings for public functions
- Keep functions focused and testable
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes with appropriate tests
-
Run the test suite:
make test make lint -
Commit your changes:
git add . git commit -m "feat: add feature description"
-
Push and create pull request:
git push origin feature/your-feature-name
- Include tests for new functionality
- Update documentation as needed
- Ensure all tests pass
- Follow conventional commit message format
- Provide clear description of changes
Tests the core defensive mode transitions (Portal → Shield → Lockdown).
Key test areas:
- State transition logic
- Event processing
- Configuration loading
- Time-based unlocking
Tests configuration file loading and validation.
Key test areas:
- YAML file parsing
- Required field validation
- Default value handling
- Schema compliance
Tests log processing from Suricata and OpenCanary.
Key test areas:
- JSON log parsing
- Event generation
- File tailing behavior
- Error handling
Tests traffic control and firewall actions.
Key test areas:
- Command generation
- Idempotent operations
- Parameter validation
- Action planning
# Run with pdb on failures
python3 -m pytest --pdb
# Run with detailed output
python3 -m pytest -vvv --tb=long
# Run specific test with print statements
python3 -m pytest tests/core/test_config.py::test_config_from_file -sTest fixtures create temporary directories and mock configurations:
- Use
temp_config_dirfor filesystem tests - Mock external dependencies (Mattermost, Suricata)
- Keep test data minimal and focused
When contributing code, also update:
- Function docstrings
- README.md if adding user-facing features
- API_REFERENCE.md for new modules
- This CONTRIBUTING.md for process changes
- Check existing issues and discussions
- Review test files for usage examples
- Read the architecture documentation in
docs/ARCHITECTURE.md - Contact maintainers for complex changes
- Never commit sensitive data or credentials
- Test security-related changes thoroughly
- Follow responsible disclosure for security issues
- Use GitHub's private vulnerability reporting
Thank you for contributing to Azazel-Edge! Your help makes this project better for everyone.