From c8190fd1c17380864750fddda7a19db22c9ef52b Mon Sep 17 00:00:00 2001 From: Paige Patton <64206430+paigerube14@users.noreply.github.com> Date: Wed, 2 Jul 2025 12:00:19 -0400 Subject: [PATCH] adding pod test (#858) Signed-off-by: Paige Patton --- .github/workflows/tests.yml | 2 ++ CI/config/common_test_config.yaml | 5 ----- CI/tests/test_pod.sh | 18 ++++++++++++++++++ scenarios/kind/pod_etcd.yml | 5 +++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100755 CI/tests/test_pod.sh create mode 100755 scenarios/kind/pod_etcd.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff37f237..756cf083 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,6 +82,7 @@ jobs: echo "test_service_hijacking" > ./CI/tests/functional_tests echo "test_app_outages" >> ./CI/tests/functional_tests echo "test_container" >> ./CI/tests/functional_tests + echo "test_pod" >> ./CI/tests/functional_tests echo "test_namespace" >> ./CI/tests/functional_tests echo "test_net_chaos" >> ./CI/tests/functional_tests echo "test_time" >> ./CI/tests/functional_tests @@ -111,6 +112,7 @@ jobs: echo "test_service_hijacking" >> ./CI/tests/functional_tests echo "test_app_outages" >> ./CI/tests/functional_tests echo "test_container" >> ./CI/tests/functional_tests + echo "test_pod" >> ./CI/tests/functional_tests echo "test_namespace" >> ./CI/tests/functional_tests echo "test_net_chaos" >> ./CI/tests/functional_tests echo "test_time" >> ./CI/tests/functional_tests diff --git a/CI/config/common_test_config.yaml b/CI/config/common_test_config.yaml index a0db6d84..fc3bdebf 100644 --- a/CI/config/common_test_config.yaml +++ b/CI/config/common_test_config.yaml @@ -2,12 +2,9 @@ kraken: distribution: kubernetes # Distribution can be kubernetes or openshift. kubeconfig_path: ~/.kube/config # Path to kubeconfig. exit_on_failure: False # Exit when a post action scenario fails. - litmus_version: v1.13.6 # Litmus version to install. - litmus_uninstall: False # If you want to uninstall litmus if failure. chaos_scenarios: # List of policies/chaos scenarios to load. - $scenario_type: # List of chaos pod scenarios to load. - $scenario_file - $post_config cerberus: cerberus_enabled: False # Enable it when cerberus is previously installed. cerberus_url: # When cerberus_enabled is set to True, provide the url where cerberus publishes go/no-go signal. @@ -52,8 +49,6 @@ telemetry: telemetry_group: "funtests" elastic: enable_elastic: False - collect_metrics: False - collect_alerts: False verify_certs: False elastic_url: "https://192.168.39.196" # To track results in elasticsearch, give url to server here; will post telemetry details when url and index not blank elastic_port: 32766 diff --git a/CI/tests/test_pod.sh b/CI/tests/test_pod.sh new file mode 100755 index 00000000..fecca10d --- /dev/null +++ b/CI/tests/test_pod.sh @@ -0,0 +1,18 @@ +set -xeEo pipefail + +source CI/tests/common.sh + +trap error ERR +trap finish EXIT + +function functional_test_pod_crash { + export scenario_type="pod_disruption_scenarios" + export scenario_file="scenarios/kind/pod_etcd.yml" + export post_config="" + envsubst < CI/config/common_test_config.yaml > CI/config/pod_config.yaml + + python3 -m coverage run -a run_kraken.py -c CI/config/pod_config.yaml + echo "Pod disruption scenario test: Success" +} + +functional_test_pod_crash diff --git a/scenarios/kind/pod_etcd.yml b/scenarios/kind/pod_etcd.yml new file mode 100755 index 00000000..deb859c2 --- /dev/null +++ b/scenarios/kind/pod_etcd.yml @@ -0,0 +1,5 @@ +- id: kill-pods + config: + namespace_pattern: "kube-system" + label_selector: "component=etcd" + krkn_pod_recovery_time: 120