Skip to content

Commit 29df6b1

Browse files
authored
Merge pull request ceph#60071 from shraddhaag/fix-mon-cluster-log-test
qa/standalone/mon/mon_cluster_log.sh: retry check for log line Reviewed-by: Nitzan Mordechai <[email protected]>
2 parents 80c29ae + 67928a2 commit 29df6b1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

qa/standalone/mon/mon-cluster-log.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function TEST_cluster_log_level() {
6262
ceph config set mon.a mon_cluster_log_level info
6363
ceph osd down 0
6464
TIMEOUT=20 wait_for_osd up 0 || return 1
65-
grep -q "cluster [[]INF[]] osd.0.*boot" $dir/log
65+
TIMEOUT=60 wait_for_string $dir/log "cluster [[]INF[]] osd.0.*boot"
6666
return_code=$?
6767
if [ $return_code -ne 0 ]; then
6868
echo "Failed : Could not find INF log in the cluster log file"
@@ -145,9 +145,17 @@ function TEST_journald_cluster_log_level() {
145145
ceph osd down 0
146146
TIMEOUT=20 wait_for_osd up 0 || return 1
147147
search_str="osd.0.*boot"
148-
sudo journalctl _COMM=ceph-mon CEPH_CHANNEL=cluster PRIORITY=6 --output=json-pretty --since "60 seconds ago" |jq '.MESSAGE' > $dir/journal.log
149-
grep -q "$search_str" $dir/journal.log
150-
return_code=$?
148+
return_code=1
149+
RETRY_DURATION=60
150+
for ((i=0; i < $RETRY_DURATION; i++)); do
151+
sudo journalctl _COMM=ceph-mon CEPH_CHANNEL=cluster PRIORITY=6 --output=json-pretty --since "60 seconds ago" |jq '.MESSAGE' > $dir/journal.log
152+
if ! grep "$search_str" $dir/journal.log; then
153+
sleep 1
154+
else
155+
return_code=0
156+
break
157+
fi
158+
done
151159
if [ $return_code -ne 0 ]; then
152160
echo "Failed : Could not find INF log in the journalctl log file"
153161
ERRORS=$(($ERRORS + 1))

0 commit comments

Comments
 (0)