Skip to content

Commit

Permalink
test: check the clusterpedia apiserver before test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Iceber Gu <[email protected]>
  • Loading branch information
Iceber committed Nov 19, 2024
1 parent fdcb2f6 commit 34e9afc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/environments/multiple.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ done

"${ROOT}/hack/gen-clusterconfigs.sh"

if ! check_clusterpedia_apiserver; then
echo "clusterpedia apiserver is not ready"
exit 1
fi

"${cases}"
5 changes: 5 additions & 0 deletions test/environments/single.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ create_data_plane ${data_plane_name} ${version} || {

"${ROOT}/hack/gen-clusterconfigs.sh"

if ! check_clusterpedia_apiserver; then
echo "clusterpedia apiserver is not ready"
exit 1
fi

"${cases}"
12 changes: 12 additions & 0 deletions test/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,15 @@ function delete_data_plane() {
kwokctl export logs --name "${name}" "${ROOT}/test/logs/kwok/${name}"
kwokctl delete cluster --name "${name}"
}

# check if the apiserver in the control plane is ready
function check_clusterpedia_apiserver() {
for i in {1..3}
do
if kubectl get --raw="/apis/clusterpedia.io/v1beta1/">/dev/null; then # only print error messages of the kubectl
return 0
fi
sleep 10
done
return 1
}

0 comments on commit 34e9afc

Please sign in to comment.