]> git.proxmox.com Git - ceph.git/blame - ceph/qa/workunits/rbd/test_rbdmap_RBDMAPFILE.sh
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / qa / workunits / rbd / test_rbdmap_RBDMAPFILE.sh
CommitLineData
7c673cae
FG
1#!/bin/sh
2#
3# Regression test for http://tracker.ceph.com/issues/14984
4#
5# When the bug is present, starting the rbdmap service causes
6# a bogus log message to be emitted to the log because the RBDMAPFILE
7# environment variable is not set.
8#
9# When the bug is not present, starting the rbdmap service will emit
10# no log messages, because /etc/ceph/rbdmap does not contain any lines
11# that require processing.
12#
13set -ex
14
15which ceph-detect-init >/dev/null || exit 1
16[ "$(ceph-detect-init)" = "systemd" ] || exit 0
17
18echo "TEST: save timestamp for use later with journalctl --since"
19TIMESTAMP=$(date +%Y-%m-%d\ %H:%M:%S)
20
21echo "TEST: assert that rbdmap has not logged anything since boot"
22journalctl -b 0 -t rbdmap | grep 'rbdmap\[[[:digit:]]' && exit 1
23journalctl -b 0 -t init-rbdmap | grep 'rbdmap\[[[:digit:]]' && exit 1
24
25echo "TEST: restart the rbdmap.service"
26sudo systemctl restart rbdmap.service
27
28echo "TEST: ensure that /usr/bin/rbdmap runs to completion"
29until sudo systemctl status rbdmap.service | grep 'active (exited)' ; do
30 sleep 0.5
31done
32
33echo "TEST: assert that rbdmap has not logged anything since TIMESTAMP"
34journalctl --since "$TIMESTAMP" -t rbdmap | grep 'rbdmap\[[[:digit:]]' && exit 1
35journalctl --since "$TIMESTAMP" -t init-rbdmap | grep 'rbdmap\[[[:digit:]]' && exit 1
36
37exit 0