Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 124fbb0

Browse files
author
James O. D. Hunt
authored
Merge pull request #1007 from chavafg/topic/fix-k8s-vol-test
k8s: tests: wait for volume to be bounded and delete pv and pvc at teardown.
2 parents fa817be + 900718f commit 124fbb0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

integration/kubernetes/k8s-volume.bats

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ setup() {
2525
}
2626

2727
@test "Create Persistent Volume" {
28+
wait_time=10
29+
sleep_time=2
2830
volume_name="pv-volume"
2931
volume_claim="pv-claim"
3032

@@ -38,7 +40,8 @@ setup() {
3840
sudo -E kubectl create -f "${pod_config_dir}/volume-claim.yaml"
3941

4042
# Check the persistent volume claim
41-
sudo -E kubectl get pvc $volume_claim | grep Bound
43+
cmd="sudo -E kubectl get pvc $volume_claim | grep Bound"
44+
waitForProcess "$wait_time" "$sleep_time" "$cmd"
4245

4346
# Create pod
4447
sudo -E kubectl create -f "${pod_config_dir}/pv-pod.yaml"
@@ -52,5 +55,7 @@ setup() {
5255

5356
teardown() {
5457
sudo -E kubectl delete pod "$pod_name"
58+
sudo -E kubectl delete pvc "$volume_claim"
59+
sudo -E kubectl delete pv "$volume_name"
5560
sudo rm -rf $tmp_file
5661
}

0 commit comments

Comments
 (0)