Skip to content

Commit

Permalink
Merge pull request #705 from clusterpedia-io/test_add_apiserver_check
Browse files Browse the repository at this point in the history
test: check the clusterpedia apiserver before test cases
  • Loading branch information
Iceber authored Nov 19, 2024
2 parents 78bef2b + 34e9afc commit 04cc096
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 04cc096

Please sign in to comment.