Skip to content

Commit

Permalink
test: backup
Browse files Browse the repository at this point in the history
  • Loading branch information
aronchanisme committed Jan 7, 2024
1 parent beb32cc commit 28e9202
Showing 1 changed file with 48 additions and 15 deletions.
63 changes: 48 additions & 15 deletions .github/workflows/unit_test_linux_ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1580,9 +1580,25 @@ jobs:
run: |
echo "----------------------------------"
echo "Test backup manually"
echo ""
mo_ctl backup
echo "Set confs for auto backup"
mo_ctl set_conf BACKUP_CRON_SCHEDULE="* * * * *"
mo_ctl set_conf BACKUP_CLEAN_DAYS_BEFORE="0"
mo_ctl set_conf BACKUP_CLEAN_CRON_SCHEDULE="*/8 * * * *"
echo "----------------------------------"
echo "Enable auto backup and auto clean backup"
mo_ctl auto_backup enable
echo "----------------------------------"
echo "Check auto backup and auto clean backup status"
mo_ctl auto_backup status
echo "----------------------------------"
echo "wait 70s for next auto backup to be performed"
sleep 70
echo "----------------------------------"
echo "Show backup path"
ls -lth ${{ env.BACKUP_PATH }}
for dir in `ls ${{ env.BACKUP_PATH }}`; do
Expand All @@ -1593,43 +1609,60 @@ jobs:
echo "----------------------------------"
echo "Clean backup automatically"
mo_ctl auto_backup
echo "Sleep 600s"
sleep 600
echo "Show backup path: ls -lth ${{ env.BACKUP_PATH }}/${RUN_MONTH}/"
ls -lth ${{ env.BACKUP_PATH }}/${RUN_MONTH}/
for dir in `ls ${{ env.BACKUP_PATH }}${RUN_MONTH}/`; do
echo "----------------------------------"
echo "Listing files in ${{ env.BACKUP_PATH }}/${dir}/"
ls -lth ${{ env.BACKUP_PATH }}/${RUN_MONTH}/${dir}/
done
dir_count=`ls ${{ env.BACKUP_PATH }}/${RUN_MONTH}/ | wc -l`
if [[ ${dir_count} -ne 0 ]]; then
echo "dir_count: ${dir_count} is not 0, seems like auto_clean_old_backup has failed"
#exit 1
fi
echo "----------------------------------"
echo "check log path ${MO_CTL_TOOL_LOG_PATH}/auto_backup/"
ls -lth ${MO_CTL_TOOL_LOG_PATH}/auto_backup/
echo "----------------------------------"
echo "check auto_backup logs: cat ${MO_CTL_TOOL_LOG_PATH}/auto_backup/*"
cat ${MO_CTL_TOOL_LOG_PATH}/auto_backup/*
echo "----------------------------------"
echo "check log path ${MO_CTL_TOOL_LOG_PATH}/auto_clean_old_backup/"
ls -lth ${MO_CTL_TOOL_LOG_PATH}/auto_clean_old_backup/
echo "----------------------------------"
echo "show auto_clean_old_backup logs: cat ${MO_CTL_TOOL_LOG_PATH}/auto_clean_old_backup/*"
cat ${MO_CTL_TOOL_LOG_PATH}/auto_clean_old_backup/*
echo "----------------------------------"
echo "check cron.d path and file"
ls -lth /etc/cron.d/
echo "----------------------------------"
echo "content of file /etc/cron.d/mo_backup"
cat /etc/cron.d/mo_backup
echo "----------------------------------"
echo "content of file /etc/cron.d/mo_clean_old_backup"
cat /etc/cron.d/mo_clean_old_backup
echo "----------------------------------"
echo "Disabling auto_backup"
mo_ctl auto_backup disable
if ! mo_ctl auto_backup; then
echo "auto_backup status failed as expected"
fi
for dir in `ls ${{ env.BACKUP_PATH }}/${RUN_MONTH}/`; do
echo "----------------------------------"
echo "Listing files in ${{ env.BACKUP_PATH }}/${RUN_MONTH}/${dir}/"
ls -lth ${{ env.BACKUP_PATH }}/${RUN_MONTH}/${dir}/
done
dir_count=`ls ${{ env.BACKUP_PATH }}/${RUN_MONTH}/ | wc -l`
if [[ ${dir_count} -ne 0 ]]; then
echo "dir_count: ${dir_count} is not 0, seems like auto_clean_old_backup has failed"
exit 1
fi

0 comments on commit 28e9202

Please sign in to comment.