-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement an integration test for recovery after a network cut (#116)
* Refactor scale down logic to not force remove unreachable instances * Add unit tests * Address lint warnings * Add sleep and idle timeout in test code in an attempt to stabilize tests * Address lint warnings * Add sleep after killing pod to give test environment time to stabilize * Wait for unit to be removed from cluster after force removing it * Wait for forcefully removed unit to actually be removed from the cluster * Add integration test for recovery after a network cut * Remove duplicate code introduced after merging main * Install helm3 in CI runner for self healing integration tests * Fix failing unit test * Pin flake8 to v5.0.4 due to incompatibilities with v6 * Install helm on CI runners using sudo * Address PR feedback; move chaos_mesh installation to fixture
- Loading branch information
1 parent
0d8ea2d
commit 592a333
Showing
10 changed files
with
344 additions
and
74 deletions.
There are no files selected for viewing
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
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
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
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
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
16 changes: 16 additions & 0 deletions
16
tests/integration/high_availability/manifests/chaos_network_loss.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: chaos-mesh.org/v1alpha1 | ||
kind: NetworkChaos | ||
metadata: | ||
name: network-loss-primary | ||
namespace: $namespace | ||
spec: | ||
action: loss | ||
mode: one | ||
selector: | ||
pods: | ||
$namespace: | ||
- $pod | ||
loss: | ||
loss: "100" | ||
correlation: "100" | ||
duration: "60m" |
22 changes: 22 additions & 0 deletions
22
tests/integration/high_availability/scripts/deploy_chaos_mesh.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
chaos_mesh_ns=$1 | ||
chaos_mesh_version="2.4.1" | ||
|
||
if [ -z "${chaos_mesh_ns}" ]; then | ||
exit 1 | ||
fi | ||
|
||
deploy_chaos_mesh() { | ||
if [ "$(helm repo list | grep 'chaos-mesh' | wc -l)" != "1" ]; then | ||
echo "adding chaos-mesh helm repo" | ||
helm repo add chaos-mesh https://charts.chaos-mesh.org | ||
fi | ||
|
||
echo "installing chaos-mesh" | ||
helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=${chaos_mesh_ns} --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/var/snap/microk8s/common/run/containerd.sock --set dashboard.create=false --version ${chaos_mesh_version} --set clusterScoped=false --set controllerManager.targetNamespace=${chaos_mesh_ns} | ||
sleep 10 | ||
} | ||
|
||
echo "namespace=${chaos_mesh_ns}" | ||
deploy_chaos_mesh |
Oops, something went wrong.