-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Continuous Testing with Pytest and GitHub Actions #4
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Checkout code - Set up Python 3.9 - Install dependencies including pytest and pytest-testinfra - Run Snort installation script - Execute tests with pytest
The code changes in `test_install.py` ensure that the `HOME_NET` variable in `snort.conf` is correctly configured. The previous implementation used the `ip` command with the `-o` and `-f inet` options to retrieve the IP address, but it didn't work as expected. The updated code now uses the `ip` command with the `-4` option and `grep` to extract the IP address. The `HOME_NET` variable is then updated in `snort.conf` to include the IP address with a `/24` subnet mask. This commit message follows the established conventions in the repository.
- Introduced fixture `host_interface_and_homenet` to dynamically retrieve the default network interface and corresponding IP address for HOME_NET. - Added `test_home_net_defined` to verify that HOME_NET is correctly defined in `snort.conf` using the retrieved IP address. - Added `test_interface_defined` to ensure the default network interface is properly specified in `snort.conf`. - Integrated these tests into the existing test suite alongside dependency installation and OSSEC configuration validation.
…hat snort.conf use
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces continuous testing for the Snort and Wazuh integration using Pytest and GitHub Actions. Key changes include:
Pytest Configuration: Added Pytest tests to validate the Snort installation and configuration. Tests ensure that Snort is correctly installed, the configuration files exist, and the system is properly configured.
GitHub Actions Workflow: Created a GitHub Actions workflow that automatically runs Pytest tests on each push and pull request. The workflow sets up the environment, installs necessary dependencies, and executes the tests to ensure the integrity of the Snort and Wazuh setup.
Testing Documentation: Added detailed documentation in
scripts/tests/README.md
to guide users on how to run tests locally and understand the testing process.These additions will help maintain high code quality and ensure that changes to the repository do not break existing functionality.