From 605064dc685aa25cc7d58ec18b6449a3ce476d01 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 30 Jul 2014 13:40:33 -0700 Subject: [PATCH] test/cli-integration/rbd: fix trailing space Newer versions of json.tool remove the trailing ' ' after the comma. Add it back in with sed so that the .t works on both old and new versions, and so that we don't have to remove the trailing spaces from all of the test cases. Backport: firefly Fixes: #8920 Signed-off-by: Sage Weil --- src/test/cli-integration/rbd/defaults.t | 26 ++++++------ .../cli-integration/rbd/formatted-output.t | 40 +++++++++---------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/test/cli-integration/rbd/defaults.t b/src/test/cli-integration/rbd/defaults.t index c2a33e4673a5d..10f3f3f2b89f2 100644 --- a/src/test/cli-integration/rbd/defaults.t +++ b/src/test/cli-integration/rbd/defaults.t @@ -1,7 +1,7 @@ Plain create with various options specified via usual cli arguments =================================================================== $ rbd create -s 1 test - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rb.0.*", (glob) "format": 1, @@ -13,7 +13,7 @@ Plain create with various options specified via usual cli arguments } $ rbd rm test --no-progress $ rbd create -s 1 --order 20 test - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rb.0.*", (glob) "format": 1, @@ -25,7 +25,7 @@ Plain create with various options specified via usual cli arguments } $ rbd rm test --no-progress $ rbd create -s 1 test --image-format 2 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -41,7 +41,7 @@ Plain create with various options specified via usual cli arguments } $ rbd rm test --no-progress $ rbd create -s 1 test --image-format 2 --order 20 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -57,7 +57,7 @@ Plain create with various options specified via usual cli arguments } $ rbd rm test --no-progress $ rbd create -s 1 test --image-format 2 --stripe-unit 1048576 --stripe-count 8 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -78,7 +78,7 @@ Plain create with various options specified via usual cli arguments Format 2 Usual arguments with custom rbd_default_* params ========================================================= $ rbd create -s 1 test --image-format 2 --stripe-unit 1048576 --stripe-count 8 --rbd-default-order 21 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -96,7 +96,7 @@ Format 2 Usual arguments with custom rbd_default_* params } $ rbd rm test --no-progress $ rbd create -s 1 test --image-format 2 --stripe-unit 1048576 --stripe-count 8 --order 23 --rbd-default-order 20 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -114,7 +114,7 @@ Format 2 Usual arguments with custom rbd_default_* params } $ rbd rm test --no-progress $ rbd create -s 1 test --image-format 2 --rbd-default-stripe-unit 1048576 --rbd-default-stripe-count 8 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -135,7 +135,7 @@ Format 2 Usual arguments with custom rbd_default_* params Format 1 Usual arguments with custom rbd_default_* params ========================================================= $ rbd create -s 1 test --rbd-default-order 20 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rb.0.*", (glob) "format": 1, @@ -147,7 +147,7 @@ Format 1 Usual arguments with custom rbd_default_* params } $ rbd rm test --no-progress $ rbd create -s 1 test --rbd-default-format 2 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -163,7 +163,7 @@ Format 1 Usual arguments with custom rbd_default_* params } $ rbd rm test --no-progress $ rbd create -s 1 test --rbd-default-format 2 --rbd-default-order 20 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -179,7 +179,7 @@ Format 1 Usual arguments with custom rbd_default_* params } $ rbd rm test --no-progress $ rbd create -s 1 test --rbd-default-format 2 --rbd-default-order 20 --rbd-default-features 1 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -195,7 +195,7 @@ Format 1 Usual arguments with custom rbd_default_* params } $ rbd rm test --no-progress $ rbd create -s 1 test --rbd-default-format 2 --stripe-unit 1048576 --stripe-count 8 - $ rbd info test --format json | python -mjson.tool + $ rbd info test --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ diff --git a/src/test/cli-integration/rbd/formatted-output.t b/src/test/cli-integration/rbd/formatted-output.t index fe4318aa5c4d4..7c657554d8437 100644 --- a/src/test/cli-integration/rbd/formatted-output.t +++ b/src/test/cli-integration/rbd/formatted-output.t @@ -53,7 +53,7 @@ For now, use a more inclusive regex. \torder 22 (4096 kB objects) (esc) [^^]+ (re) \tformat: 1 (esc) - $ rbd info foo --format json | python -mjson.tool + $ rbd info foo --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rb.0.*", (glob) "format": 1, @@ -82,7 +82,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. [^^]+ (re) \tformat: 1 (esc) \tprotected: False (esc) - $ rbd info foo@snap --format json | python -mjson.tool + $ rbd info foo@snap --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rb.0.*", (glob) "format": 1, @@ -111,7 +111,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. [^^]+ (re) \tformat: 2 (esc) \tfeatures: layering (esc) - $ rbd info bar --format json | python -mjson.tool + $ rbd info bar --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -147,7 +147,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. \tformat: 2 (esc) \tfeatures: layering (esc) \tprotected: True (esc) - $ rbd info bar@snap --format json | python -mjson.tool + $ rbd info bar@snap --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -185,7 +185,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. \tformat: 2 (esc) \tfeatures: layering (esc) \tprotected: False (esc) - $ rbd info bar@snap2 --format json | python -mjson.tool + $ rbd info bar@snap2 --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -222,7 +222,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. [^^]+ (re) \tformat: 2 (esc) \tfeatures: layering (esc) - $ rbd info baz --format json | python -mjson.tool + $ rbd info baz --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -256,7 +256,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. \torder 22 (4096 kB objects) (esc) [^^]+ (re) \tformat: 1 (esc) - $ rbd info quux --format json | python -mjson.tool + $ rbd info quux --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rb.0.*", (glob) "format": 1, @@ -283,7 +283,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. [^^]+ (re) \tformat: 2 (esc) \tfeatures: layering (esc) - $ rbd info rbd_other/child --format json | python -mjson.tool + $ rbd info rbd_other/child --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -321,7 +321,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. \tprotected: False (esc) \tparent: rbd/bar@snap (esc) \toverlap: 512 MB (esc) - $ rbd info rbd_other/child@snap --format json | python -mjson.tool + $ rbd info rbd_other/child@snap --format json | python -mjson.tool | sed 's/,$/, /' { "block_name_prefix": "rbd_data.*", (glob) "features": [ @@ -368,7 +368,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. quux bar baz - $ rbd list --format json | python -mjson.tool + $ rbd list --format json | python -mjson.tool | sed 's/,$/, /' [ "foo", "quux", @@ -391,7 +391,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. bar@snap 512M 2 yes bar@snap2 1024M 2 baz 2048M 2 shr - $ rbd list -l --format json | python -mjson.tool + $ rbd list -l --format json | python -mjson.tool | sed 's/,$/, /' [ { "format": 1, @@ -485,7 +485,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. $ rbd list rbd_other child - $ rbd list rbd_other --format json | python -mjson.tool + $ rbd list rbd_other --format json | python -mjson.tool | sed 's/,$/, /' [ "child" ] @@ -497,7 +497,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. NAME SIZE PARENT FMT PROT LOCK child 512M 2 child@snap 512M rbd/bar@snap 2 - $ rbd list rbd_other -l --format json | python -mjson.tool + $ rbd list rbd_other -l --format json | python -mjson.tool | sed 's/,$/, /' [ { "format": 2, @@ -538,7 +538,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. $ rbd lock list foo - $ rbd lock list foo --format json | python -mjson.tool + $ rbd lock list foo --format json | python -mjson.tool | sed 's/,$/, /' {} $ rbd lock list foo --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp' @@ -546,7 +546,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. There is 1 exclusive lock on this image. Locker*ID*Address* (glob) client.* id * (glob) - $ rbd lock list quux --format json | python -mjson.tool + $ rbd lock list quux --format json | python -mjson.tool | sed 's/,$/, /' { "id": { "address": "*", (glob) @@ -567,7 +567,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. client.*id[123].* (re) client.*id[123].* (re) client.*id[123].* (re) - $ rbd lock list baz --format json | python -mjson.tool + $ rbd lock list baz --format json | python -mjson.tool | sed 's/,$/, /' { "id1": { "address": "*", (glob) @@ -600,7 +600,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. $ rbd snap list foo SNAPID NAME SIZE *snap*1024*MB* (glob) - $ rbd snap list foo --format json | python -mjson.tool + $ rbd snap list foo --format json | python -mjson.tool | sed 's/,$/, /' [ { "id": *, (glob) @@ -620,7 +620,7 @@ whenever it is run. grep -v to ignore it, but still work on other distros. SNAPID NAME SIZE *snap*512*MB* (glob) *snap2*1024*MB* (glob) - $ rbd snap list bar --format json | python -mjson.tool + $ rbd snap list bar --format json | python -mjson.tool | sed 's/,$/, /' [ { "id": *, (glob) @@ -647,14 +647,14 @@ whenever it is run. grep -v to ignore it, but still work on other distros. $ rbd snap list baz - $ rbd snap list baz --format json | python -mjson.tool + $ rbd snap list baz --format json | python -mjson.tool | sed 's/,$/, /' [] $ rbd snap list baz --format xml | xml_pp 2>&1 | grep -v '^new version at /usr/bin/xml_pp' $ rbd snap list rbd_other/child SNAPID NAME SIZE *snap*512*MB* (glob) - $ rbd snap list rbd_other/child --format json | python -mjson.tool + $ rbd snap list rbd_other/child --format json | python -mjson.tool | sed 's/,$/, /' [ { "id": *, (glob) -- 2.47.3