Skip to content

Commit

Permalink
qa/workunits/rbd: expand LevelSpec parsing coverage
Browse files Browse the repository at this point in the history
Invoke "rbd mirror snapshot schedule ls -R" and "rbd mirror snapshot
schedule status" commands on all levels, consistently.  In particular,
make sure that an image level schedule is listed for a recursive query
at the pool level both before and after the schedule kicks in:

  $ rbd create --size 1G --mirror-image-mode snapshot -p foo bar
  $ rbd mirror snapshot schedule add -p foo --image bar 1m
  $ rbd mirror snapshot schedule ls -p foo -R
  POOL  NAMESPACE  IMAGE  SCHEDULE
  foo              bar    every 1m
  <wait for schedule to become visible in status>
  $ rbd mirror snapshot schedule ls -p foo -R
  POOL  NAMESPACE  IMAGE  SCHEDULE
  foo              bar    every 1m

Also, make sure that pool and image level status queries work:

  $ rbd mirror snapshot schedule status -p foo
  SCHEDULE TIME        IMAGE
  2022-03-04 07:14:00  foo/bar
  $ rbd mirror snapshot schedule status -p foo --image bar
  SCHEDULE TIME        IMAGE
  2022-03-04 07:14:00  foo/bar

Both of these issues are fixed by the previous commit.

Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
idryomov committed Mar 5, 2022
1 parent 05f2cfd commit 08df6e0
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions qa/workunits/rbd/cli_generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,8 @@ test_trash_purge_schedule() {
rbd trash purge schedule status
test "$(rbd trash purge schedule status --format xml |
$XMLSTARLET sel -t -v '//scheduled/item/pool')" = 'rbd'
test "$(rbd trash purge schedule status -p rbd --format xml |
$XMLSTARLET sel -t -v '//scheduled/item/pool')" = 'rbd'

rbd trash purge schedule add 2d 00:17
rbd trash purge schedule ls | grep 'every 2d starting at 00:17'
Expand All @@ -1180,6 +1182,12 @@ test_trash_purge_schedule() {
rbd trash purge schedule status
rbd trash purge schedule status --format xml |
$XMLSTARLET sel -t -v '//scheduled/item/pool' | grep 'rbd2'
test "$(echo $(rbd trash purge schedule status --format xml |
$XMLSTARLET sel -t -v '//scheduled/item/pool'))" = 'rbd rbd2 rbd2'
test "$(rbd trash purge schedule status -p rbd --format xml |
$XMLSTARLET sel -t -v '//scheduled/item/pool')" = 'rbd'
test "$(echo $(rbd trash purge schedule status -p rbd2 --format xml |
$XMLSTARLET sel -t -v '//scheduled/item/pool'))" = 'rbd2 rbd2'

test "$(echo $(rbd trash purge schedule ls -R --format xml |
$XMLSTARLET sel -t -v '//schedules/schedule/items'))" = "2d00:17:00 1d01:30:00"
Expand All @@ -1202,6 +1210,7 @@ test_trash_purge_schedule() {
rbd trash ls rbd2/ns1 | wc -l | grep '^1$'

rbd trash purge schedule add -p $p 1m
rbd trash purge schedule list -p rbd2 -R | grep 'every 1m'
rbd trash purge schedule list -p rbd2/ns1 -R | grep 'every 1m'

for i in `seq 12`; do
Expand All @@ -1210,7 +1219,14 @@ test_trash_purge_schedule() {
done
rbd trash ls rbd2/ns1 | wc -l | grep '^0$'

# repeat with kicked in schedule, see https://tracker.ceph.com/issues/53915
rbd trash purge schedule list -p rbd2 -R | grep 'every 1m'
rbd trash purge schedule list -p rbd2/ns1 -R | grep 'every 1m'

rbd trash purge schedule status | grep 'rbd2 *ns1'
rbd trash purge schedule status -p rbd2 | grep 'rbd2 *ns1'
rbd trash purge schedule status -p rbd2/ns1 | grep 'rbd2 *ns1'

rbd trash purge schedule rm -p $p 1m
done

Expand Down Expand Up @@ -1257,8 +1273,14 @@ test_mirror_snapshot_schedule() {
test "$(rbd mirror image status rbd2/ns1/test1 |
grep -c mirror.primary)" = '1'

rbd mirror snapshot schedule add --image rbd2/ns1/test1 1m
test "$(rbd mirror snapshot schedule ls --image rbd2/ns1/test1)" = 'every 1m'
rbd mirror snapshot schedule add -p rbd2/ns1 --image test1 1m
expect_fail rbd mirror snapshot schedule ls
rbd mirror snapshot schedule ls -R | grep 'rbd2 *ns1 *test1 *every 1m'
expect_fail rbd mirror snapshot schedule ls -p rbd2
rbd mirror snapshot schedule ls -p rbd2 -R | grep 'rbd2 *ns1 *test1 *every 1m'
expect_fail rbd mirror snapshot schedule ls -p rbd2/ns1
rbd mirror snapshot schedule ls -p rbd2/ns1 -R | grep 'rbd2 *ns1 *test1 *every 1m'
test "$(rbd mirror snapshot schedule ls -p rbd2/ns1 --image test1)" = 'every 1m'

for i in `seq 12`; do
test "$(rbd mirror image status rbd2/ns1/test1 |
Expand All @@ -1269,15 +1291,36 @@ test_mirror_snapshot_schedule() {
test "$(rbd mirror image status rbd2/ns1/test1 |
grep -c mirror.primary)" -gt '1'

# repeat with kicked in schedule, see https://tracker.ceph.com/issues/53915
expect_fail rbd mirror snapshot schedule ls
rbd mirror snapshot schedule ls -R | grep 'rbd2 *ns1 *test1 *every 1m'
expect_fail rbd mirror snapshot schedule ls -p rbd2
rbd mirror snapshot schedule ls -p rbd2 -R | grep 'rbd2 *ns1 *test1 *every 1m'
expect_fail rbd mirror snapshot schedule ls -p rbd2/ns1
rbd mirror snapshot schedule ls -p rbd2/ns1 -R | grep 'rbd2 *ns1 *test1 *every 1m'
test "$(rbd mirror snapshot schedule ls -p rbd2/ns1 --image test1)" = 'every 1m'

rbd mirror snapshot schedule status
test "$(rbd mirror snapshot schedule status --format xml |
$XMLSTARLET sel -t -v '//scheduled_images/image/image')" = 'rbd2/ns1/test1'
test "$(rbd mirror snapshot schedule status -p rbd2 --format xml |
$XMLSTARLET sel -t -v '//scheduled_images/image/image')" = 'rbd2/ns1/test1'
test "$(rbd mirror snapshot schedule status -p rbd2/ns1 --format xml |
$XMLSTARLET sel -t -v '//scheduled_images/image/image')" = 'rbd2/ns1/test1'
test "$(rbd mirror snapshot schedule status -p rbd2/ns1 --image test1 --format xml |
$XMLSTARLET sel -t -v '//scheduled_images/image/image')" = 'rbd2/ns1/test1'

rbd mirror snapshot schedule add 1h 00:15
test "$(rbd mirror snapshot schedule ls)" = 'every 1h starting at 00:15:00'
rbd mirror snapshot schedule ls -R | grep 'every 1h starting at 00:15:00'
rbd mirror snapshot schedule ls -R | grep 'rbd2 *ns1 *test1 *every 1m'
expect_fail rbd mirror snapshot schedule ls -p rbd2
rbd mirror snapshot schedule ls -p rbd2 -R | grep 'every 1h starting at 00:15:00'
rbd mirror snapshot schedule ls -p rbd2 -R | grep 'rbd2 *ns1 *test1 *every 1m'
expect_fail rbd mirror snapshot schedule ls -p rbd2/ns1
rbd mirror snapshot schedule ls -p rbd2/ns1 -R | grep 'every 1h starting at 00:15:00'
rbd mirror snapshot schedule ls -p rbd2/ns1 -R | grep 'rbd2 *ns1 *test1 *every 1m'
test "$(rbd mirror snapshot schedule ls -p rbd2/ns1 --image test1)" = 'every 1m'

# Negative tests
expect_fail rbd mirror snapshot schedule add dummy
Expand Down

0 comments on commit 08df6e0

Please sign in to comment.