Skip to content

Commit

Permalink
test: fix broken wait_for_prepare_pod helper
Browse files Browse the repository at this point in the history
The wait_for_prepare_pod function was broken, but its failures were not
exposed due to the old way helper functions were called. Fix the
function.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
  • Loading branch information
BlaineEXE committed Oct 6, 2021
1 parent 1058802 commit 71737d1
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions tests/scripts/github-action-helper.sh
Expand Up @@ -169,23 +169,22 @@ function deploy_cluster() {
}

function wait_for_prepare_pod() {
timeout 180 bash <<-'EOF'
while true; do
if [[ "$(kubectl -n rook-ceph get pod -l app=rook-ceph-osd-prepare --field-selector=status.phase=Running)" -gt 1 ]]; then
break
fi
sleep 5
done
kubectl -n rook-ceph logs --follow pod/$(kubectl -n rook-ceph get pod -l app=rook-ceph-osd-prepare -o jsonpath='{.items[0].metadata.name}')
EOF
timeout 60 bash <<-'EOF'
until kubectl -n rook-ceph logs $(kubectl -n rook-ceph get pod -l app=rook-ceph-osd,ceph_daemon_id=0 -o jsonpath='{.items[*].metadata.name}') --all-containers || true; do
echo "waiting for osd container"
sleep 1
done
EOF
kubectl -n rook-ceph describe job/"$(kubectl -n rook-ceph get pod -l app=rook-ceph-osd-prepare -o jsonpath='{.items[*].metadata.name}')" || true
kubectl -n rook-ceph describe deploy/rook-ceph-osd-0 || true
get_pod_cmd=(kubectl --namespace rook-ceph get pod --no-headers --output name)
timeout 180 bash -c \
"until [[ -n \"\$(${get_pod_cmd[*]} --selector app=rook-ceph-osd-prepare --field-selector=status.phase=Running)\" ]]; do \
echo waiting for osd prepare pod to be running && sleep 5; \
done"
pod="$("${get_pod_cmd[@]}" --selector app=rook-ceph-osd-prepare)"
kubectl --namespace rook-ceph logs --follow "$pod"
timeout 60 bash -c \
"until [[ -n \"\$(${get_pod_cmd[*]} --selector app=rook-ceph-osd,ceph_daemon_id=0 --field-selector=status.phase=Running)\" ]]; do \
echo waiting for osd pod to be running && sleep 1; \
done"
pod="$("${get_pod_cmd[@]}" --selector app=rook-ceph-osd,ceph_daemon_id=0)" || true
kubectl --namespace rook-ceph logs "$pod" || true
job="$(kubectl --namespace rook-ceph get job --selector app=rook-ceph-osd-prepare --output name)" || true
kubectl -n rook-ceph describe "$job" || true
kubectl -n rook-ceph describe deployment/rook-ceph-osd-0 || true
}

function wait_for_ceph_to_be_ready() {
Expand Down Expand Up @@ -218,11 +217,25 @@ function create_LV_on_disk() {
function deploy_first_rook_cluster() {
BLOCK=$(sudo lsblk|awk '/14G/ {print $1}'| head -1)
cd cluster/examples/kubernetes/ceph/
kubectl create -f crds.yaml -f common.yaml -f operator.yaml
create_cluster_prerequisites
deploy_manifest_with_local_build operator.yaml
yq w -i -d1 cluster-test.yaml spec.dashboard.enabled false
yq w -i -d1 cluster-test.yaml spec.storage.useAllDevices false
yq w -i -d1 cluster-test.yaml spec.storage.deviceFilter "${BLOCK}"1
kubectl create -f cluster-test.yaml -f toolbox.yaml
kubectl create -f cluster-test.yaml
deploy_manifest_with_local_build toolbox.yaml
}

function deploy_second_rook_cluster() {
BLOCK=$(sudo lsblk|awk '/14G/ {print $1}'| head -1)
cd cluster/examples/kubernetes/ceph/
NAMESPACE=rook-ceph-secondary envsubst < common-second-cluster.yaml | kubectl create -f -
sed -i 's/namespace: rook-ceph/namespace: rook-ceph-secondary/g' cluster-test.yaml
yq w -i -d1 cluster-test.yaml spec.storage.deviceFilter "${BLOCK}"2
yq w -i -d1 cluster-test.yaml spec.dataDirHostPath "/var/lib/rook-external"
kubectl create -f cluster-test.yaml
yq w -i toolbox.yaml metadata.namespace rook-ceph-secondary
deploy_manifest_with_local_build toolbox.yaml toolbox.yaml
}

function wait_for_rgw_pods() {
Expand Down Expand Up @@ -266,17 +279,6 @@ function restart_operator () {
"${get_pod_cmd[@]}"
}

function deploy_second_rook_cluster() {
BLOCK=$(sudo lsblk|awk '/14G/ {print $1}'| head -1)
cd cluster/examples/kubernetes/ceph/
NAMESPACE=rook-ceph-secondary envsubst < common-second-cluster.yaml | kubectl create -f -
sed -i 's/namespace: rook-ceph/namespace: rook-ceph-secondary/g' cluster-test.yaml
yq w -i -d1 cluster-test.yaml spec.storage.deviceFilter "${BLOCK}"2
yq w -i -d1 cluster-test.yaml spec.dataDirHostPath "/var/lib/rook-external"
yq w -i toolbox.yaml metadata.namespace rook-ceph-secondary
kubectl create -f cluster-test.yaml -f toolbox.yaml
}

function write_object_to_cluster1_read_from_cluster2() {
cd cluster/examples/kubernetes/ceph/
echo "[default]" > s3cfg
Expand Down

0 comments on commit 71737d1

Please sign in to comment.