* Add PVC outage scenario plugin to manage PVC annotations during outages
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Remove PvcOutageScenarioPlugin as it is no longer needed; refactor PvcScenarioPlugin to include rollback functionality for temporary file cleanup during PVC scenarios.
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Refactor rollback_data handling in PvcScenarioPlugin to use str() instead of json.dumps() for resource_identifier.
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Import json module in PvcScenarioPlugin for decoding rollback data from resource_identifier.
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* feat: Encode rollback data in base64 format for resource_identifier in PvcScenarioPlugin to enhance data handling and security.
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* feat: refactor: Update logging level from debug to info for temp file operations in PvcScenarioPlugin to improve visibility of command execution.
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Add unit tests for PvcScenarioPlugin methods and enhance test coverage
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Add missed lines test cov
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor tests in test_pvc_scenario_plugin.py to use unittest framework and enhance test coverage for to_kbytes method
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Enhance rollback_temp_file test to verify logging of errors for invalid data
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor tests in TestPvcScenarioPluginRun to clarify pod_name behavior and enhance logging verification in rollback_temp_file tests
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactored imports
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor assertions in test cases to use assertEqual for consistency
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
---------
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
Co-authored-by: Paige Patton <64206430+paigerube14@users.noreply.github.com>
* Add rollback functionality to ServiceHijackingScenarioPlugin
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Refactor rollback data handling in ServiceHijackingScenarioPlugin as json string
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Update rollback data handling in ServiceHijackingScenarioPlugin to decode directly from resource_identifier
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Add import statement for JSON handling in ServiceHijackingScenarioPlugin
This change introduces an import statement for the JSON module to facilitate the decoding of rollback data from the resource identifier.
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* feat: Enhance rollback data handling in ServiceHijackingScenarioPlugin by encoding and decoding as base64 strings.
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Add rollback tests for ServiceHijackingScenarioPlugin
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor rollback tests for ServiceHijackingScenarioPlugin to improve error logging and remove temporary path dependency
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Remove redundant import of yaml in test_service_hijacking_scenario_plugin.py
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor rollback tests for ServiceHijackingScenarioPlugin to enhance readability and consistency
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
---------
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
Co-authored-by: Paige Patton <64206430+paigerube14@users.noreply.github.com>
* Kubevirt VM outage tests with improved mocking and validation scenarios at test_kubevirt_vm_outage.py
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor Kubevirt VM outage tests to improve time mocking and response handling
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Remove unused subproject reference for pvc_outage
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor Kubevirt VM outage tests to enhance time mocking and improve response handling
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Enhance VMI deletion test by mocking unchanged creationTimestamp to exercise timeout path
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor Kubevirt VM outage tests to use dynamic timestamps and improve mock handling
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
---------
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
Co-authored-by: Tullio Sebastiani <tsebastiani@users.noreply.github.com>
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 10m3s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped
* Add rollback functionality to SynFloodScenarioPlugin
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Refactor rollback pod handling in SynFloodScenarioPlugin to handle podnames as string
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Update resource identifier handling in SynFloodScenarioPlugin to use list format for rollback functionality
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Refactor chaos scenario configurations in config.yaml to comment out existing scenarios for clarity. Update rollback method in SynFloodScenarioPlugin to improve pod cleanup handling. Modify pvc_scenario.yaml with specific test values for better usability.
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
* Enhance rollback functionality in SynFloodScenarioPlugin by encoding pod names in base64 format for improved data handling.
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Add unit tests for SynFloodScenarioPlugin methods and rollback functionality
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor TestSynFloodRun and TestRollbackSynFloodPods to inherit from unittest.TestCase
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
* Refactor SynFloodRun tests to use tempfile for scenario file creation and improve error logging in rollback functionality
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
---------
Signed-off-by: sanjay7178 <saisanjay7660@gmail.com>
Signed-off-by: Sai Sanjay <saisanjay7660@gmail.com>
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 9m28s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped
* Validate version file format
* Add validation for context dir, Exexcute all files by default
* Consolidate execute and cleanup, rename with .executed instead of
removing
* Respect auto_rollback config
* Add cleanup back but only for scenario successed
---------
Co-authored-by: Tullio Sebastiani <tsebastiani@users.noreply.github.com>
* feat: Add exclude_label feature to pod network outage scenarios
This feature enables filtering out specific pods from network outage
chaos testing based on label selectors. Users can now target all pods
in a namespace except critical ones by specifying exclude_label.
- Added exclude_label parameter to list_pods() function
- Updated get_test_pods() to pass the exclude parameter
- Added exclude_label field to all relevant plugin classes
- Updated schema.json with the new parameter
- Added documentation and examples
- Created comprehensive unit tests
Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
* krkn-lib update
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
* removed plugin schema
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
---------
Signed-off-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
Co-authored-by: Priyansh Saxena <130545865+Transcendental-Programmer@users.noreply.github.com>
Functional & Unit Tests / Functional & Unit Tests (push) Failing after 9m18s
Functional & Unit Tests / Generate Coverage Badge (push) Has been skipped
* Add rollback config
* Inject rollback handler to scenario plugin
* Add Serializer
* Add decorator
* Add test with SimpleRollbackScenarioPlugin
* Add logger for verbose debug flow
* Resolve review comment
- remove additional rollback config in config.yaml
- set KUBECONFIG to ~/.kube/config in test_rollback
* Simplify set_rollback_context_decorator
* Fix integration of rollback_handler in __load_plugins
* Refactor rollback.config module
- make it singleton class with register method to construct
- RollbackContext ( <timestamp>-<run_uuid> )
- add get_rollback_versions_directory for moduling the directory
format
* Adapt new rollback.config
* Refactor serialization
- respect rollback_callable_name
- refactor _parse_rollback_callable_code
- refine VERSION_FILE_TEMPLATE
* Add get_scenario_rollback_versions_directory in RollbackConfig
* Add rollback in ApplicationOutageScenarioPlugin
* Add RollbackCallable and RollbackContent for type annotation
* Refactor rollback_handler with limited arguments
* Refactor the serialization for rollback
- limited arguments: callback and rollback_content just these two!
- always constuct lib_openshift and lib_telemetry in version file
- add _parse_rollback_content_definition for retrieving scenaio specific
rollback_content
- remove utils for formating variadic function
* Refactor applicaton outage scenario
* Fix test_rollback
* Make RollbackContent with static fields
* simplify serialization
- Remove all unused format dynamic arguments utils
- Add jinja template for version file
- Replace set_context for serialization with passing version to serialize_callable
* Add rollback for hogs scenario
* Fix version file full path based on feedback
- {versions_directory}/<timestamp(ns)>-<run_uuid>/{scenario_type}-<timestamp(ns)>-<random_hash>.py
* Fix scenario plugins after rebase
* Add rollback config
* Inject rollback handler to scenario plugin
* Add test with SimpleRollbackScenarioPlugin
* Resolve review comment
- remove additional rollback config in config.yaml
- set KUBECONFIG to ~/.kube/config in test_rollback
* Fix integration of rollback_handler in __load_plugins
* Refactor rollback.config module
- make it singleton class with register method to construct
- RollbackContext ( <timestamp>-<run_uuid> )
- add get_rollback_versions_directory for moduling the directory
format
* Adapt new rollback.config
* Add rollback in ApplicationOutageScenarioPlugin
* Add RollbackCallable and RollbackContent for type annotation
* Refactor applicaton outage scenario
* Fix test_rollback
* Make RollbackContent with static fields
* simplify serialization
- Remove all unused format dynamic arguments utils
- Add jinja template for version file
- Replace set_context for serialization with passing version to serialize_callable
* Add rollback for hogs scenario
* Fix version file full path based on feedback
- {versions_directory}/<timestamp(ns)>-<run_uuid>/{scenario_type}-<timestamp(ns)>-<random_hash>.py
* Fix scenario plugins after rebase
* Add execute rollback
* Add CLI for list and execute rollback
* Replace subprocess with importlib
* Fix error after rebase
* fixup! Fix docstring
- Add telemetry_ocp in execute_rollback docstring
- Remove rollback_config in create_plugin docstring
- Remove scenario_types in set_rollback_callable docsting
* fixup! Replace os.urandom with krkn_lib.utils.get_random_string
* fixup! Add missing telemetry_ocp for execute_rollback_version_files
* fixup! Remove redundant import
- Remove duplicate TYPE_CHECKING in handler module
- Remove cast in signal module
- Remove RollbackConfig in scenario_plugin_factory
* fixup! Replace sys.exit(1) with return
* fixup! Remove duplicate rollback_network_policy
* fixup! Decouple Serializer initialization
* fixup! Rename callback to rollback_callable
* fixup! Refine comment for constructing AbstractScenarioPlugin with
placeholder value
* fixup! Add version in docstring
* fixup! Remove uv.lock
previously the test was looking for master label.
Recent kubernetes uses control-plane lable instead.
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>