Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASMINST-7173 add retry logic to postgres_clusters_running.sh #681

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions goss-testing/scripts/postgres_clusters_running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,29 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
failFlag=0
postgresStatuses="$(kubectl get postgresql -A -o jsonpath='{.items[*].status.PostgresClusterStatus}')"
for status in $postgresStatuses
maxRetries=3
retryCount=0
retryDelay=2

while [[ $retryCount -lt $maxRetries ]]
do
if [[ $status != "Running" && $status != "Updating" ]]; then failFlag=1; fi
failFlag=0
postgresStatuses="$(kubectl get postgresql -A -o jsonpath='{.items[*].status.PostgresClusterStatus}')"
for status in $postgresStatuses
do
if [[ $status != "Running" && $status != "Updating" ]]; then failFlag=1; fi
done

if [[ $failFlag -eq 0 ]]; then
result="PASS"
break
else
result="FAIL"
fi

retryCount=$((retryCount + 1))
sleep "$retryDelay"
done

if [[ $failFlag -eq 0 ]]; then echo "PASS"; exit 0;
else exit 1
fi
echo "$result"
if [[ $result == "PASS" ]]; then exit 0; else exit 1; fi