summaryrefslogtreecommitdiffstats
path: root/src/test/cli/monmaptool
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/test/cli/monmaptool
parentInitial commit. (diff)
downloadceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz
ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/cli/monmaptool')
-rw-r--r--src/test/cli/monmaptool/add-exists.t27
-rw-r--r--src/test/cli/monmaptool/add-many.t33
-rw-r--r--src/test/cli/monmaptool/clobber.t40
-rw-r--r--src/test/cli/monmaptool/create-print.t20
-rw-r--r--src/test/cli/monmaptool/create-with-add.t13
-rw-r--r--src/test/cli/monmaptool/feature-set-unset-list.t86
-rw-r--r--src/test/cli/monmaptool/help.t10
-rw-r--r--src/test/cli/monmaptool/print-empty.t5
-rw-r--r--src/test/cli/monmaptool/print-nonexistent.t4
-rw-r--r--src/test/cli/monmaptool/rm-nonexistent.t25
-rw-r--r--src/test/cli/monmaptool/rm.t22
-rw-r--r--src/test/cli/monmaptool/simple.t3
12 files changed, 288 insertions, 0 deletions
diff --git a/src/test/cli/monmaptool/add-exists.t b/src/test/cli/monmaptool/add-exists.t
new file mode 100644
index 00000000..d652a1bd
--- /dev/null
+++ b/src/test/cli/monmaptool/add-exists.t
@@ -0,0 +1,27 @@
+ $ monmaptool --create mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (0 monitors)
+
+ $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+
+ $ monmaptool --add foo 2.3.4.5:6789 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: writing epoch 0 to mymonmap (1 monitors)
+ $ monmaptool --add foo 3.4.5.6:7890 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: map already contains mon.foo
+ monmaptool -h for usage
+ [1]
+
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+ 0: v1:2.3.4.5:6789/0 mon.foo
+
+ $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+ $ [ "$ORIG_FSID" = "$NEW_FSID" ]
diff --git a/src/test/cli/monmaptool/add-many.t b/src/test/cli/monmaptool/add-many.t
new file mode 100644
index 00000000..6280a0d3
--- /dev/null
+++ b/src/test/cli/monmaptool/add-many.t
@@ -0,0 +1,33 @@
+ $ monmaptool --create mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (0 monitors)
+
+ $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+
+ $ monmaptool --add foo 2.3.4.5:6789 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: writing epoch 0 to mymonmap (1 monitors)
+ $ monmaptool --add bar 3.4.5.6:7890 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: writing epoch 0 to mymonmap (2 monitors)
+ $ monmaptool --add baz 4.5.6.7:8901 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: writing epoch 0 to mymonmap (3 monitors)
+ $ monmaptool --addv fiz '[v2:172.21.15.68:6791,v1:172.21.15.68:6792]' mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: writing epoch 0 to mymonmap (4 monitors)
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+ 0: v1:2.3.4.5:6789/0 mon.foo
+ 1: [v2:172.21.15.68:6791/0,v1:172.21.15.68:6792/0] mon.fiz
+ 2: v2:3.4.5.6:7890/0 mon.bar
+ 3: v2:4.5.6.7:8901/0 mon.baz
+
+ $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+ $ [ "$ORIG_FSID" = "$NEW_FSID" ]
diff --git a/src/test/cli/monmaptool/clobber.t b/src/test/cli/monmaptool/clobber.t
new file mode 100644
index 00000000..05a55b36
--- /dev/null
+++ b/src/test/cli/monmaptool/clobber.t
@@ -0,0 +1,40 @@
+ $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (1 monitors)
+
+ $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+
+ $ monmaptool --create mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: mymonmap exists, --clobber to overwrite
+ [255]
+
+# hasn't changed yet
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+ 0: v1:2.3.4.5:6789/0 mon.foo
+
+ $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+ $ [ "$ORIG_FSID" = "$NEW_FSID" ]
+
+ $ monmaptool --create --clobber mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (0 monitors)
+
+ $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+ $ [ "$ORIG_FSID" != "$NEW_FSID" ]
+
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
diff --git a/src/test/cli/monmaptool/create-print.t b/src/test/cli/monmaptool/create-print.t
new file mode 100644
index 00000000..51b255b4
--- /dev/null
+++ b/src/test/cli/monmaptool/create-print.t
@@ -0,0 +1,20 @@
+ $ monmaptool --create mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (0 monitors)
+
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+
+ $ monmaptool --print -- mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
diff --git a/src/test/cli/monmaptool/create-with-add.t b/src/test/cli/monmaptool/create-with-add.t
new file mode 100644
index 00000000..19ba9699
--- /dev/null
+++ b/src/test/cli/monmaptool/create-with-add.t
@@ -0,0 +1,13 @@
+ $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (1 monitors)
+
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+ 0: v1:2.3.4.5:6789/0 mon.foo
diff --git a/src/test/cli/monmaptool/feature-set-unset-list.t b/src/test/cli/monmaptool/feature-set-unset-list.t
new file mode 100644
index 00000000..c44f14bc
--- /dev/null
+++ b/src/test/cli/monmaptool/feature-set-unset-list.t
@@ -0,0 +1,86 @@
+ $ monmaptool --create --add a 10.10.10.10:1234 /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to /tmp/test.monmap.1234 (1 monitors)
+
+ $ monmaptool --feature-list --feature-list plain --feature-list parseable /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ MONMAP FEATURES:
+ persistent: [none]
+ optional: [none]
+ required: [none]
+
+ AVAILABLE FEATURES:
+ supported: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ persistent: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ MONMAP FEATURES:
+ persistent: [none]
+ optional: [none]
+ required: [none]
+
+ AVAILABLE FEATURES:
+ supported: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ persistent: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ monmap:persistent:[none]
+ monmap:optional:[none]
+ monmap:required:[none]
+ available:supported:[kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ available:persistent:[kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+
+ $ monmaptool --feature-set foo /tmp/test.monmap.1234
+ unknown features name 'foo' or unable to parse value: Expected option value to be integer, got 'foo'
+ monmaptool -h for usage
+ [1]
+
+ $ monmaptool --feature-set kraken --feature-set 64 --optional --feature-set 32 --persistent /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ monmaptool: writing epoch 0 to /tmp/test.monmap.1234 (1 monitors)
+
+ $ monmaptool --feature-list /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ MONMAP FEATURES:
+ persistent: [kraken(1),unknown(32)]
+ optional: [unknown(64)]
+ required: [kraken(1),unknown(32),unknown(64)]
+
+ AVAILABLE FEATURES:
+ supported: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ persistent: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+
+ $ monmaptool --feature-unset 32 --optional --feature-list /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ MONMAP FEATURES:
+ persistent: [kraken(1),unknown(32)]
+ optional: [unknown(64)]
+ required: [kraken(1),unknown(32),unknown(64)]
+
+ AVAILABLE FEATURES:
+ supported: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ persistent: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ monmaptool: writing epoch 0 to /tmp/test.monmap.1234 (1 monitors)
+
+ $ monmaptool --feature-unset 32 --persistent --feature-unset 64 --optional --feature-list /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ MONMAP FEATURES:
+ persistent: [kraken(1)]
+ optional: [none]
+ required: [kraken(1)]
+
+ AVAILABLE FEATURES:
+ supported: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ persistent: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ monmaptool: writing epoch 0 to /tmp/test.monmap.1234 (1 monitors)
+
+ $ monmaptool --feature-unset kraken --feature-list /tmp/test.monmap.1234
+ monmaptool: monmap file /tmp/test.monmap.1234
+ MONMAP FEATURES:
+ persistent: [none]
+ optional: [none]
+ required: [none]
+
+ AVAILABLE FEATURES:
+ supported: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ persistent: [kraken(1),luminous(2),mimic(4),osdmap-prune(8),nautilus(16)]
+ monmaptool: writing epoch 0 to /tmp/test.monmap.1234 (1 monitors)
+
+ $ rm /tmp/test.monmap.1234
diff --git a/src/test/cli/monmaptool/help.t b/src/test/cli/monmaptool/help.t
new file mode 100644
index 00000000..22023966
--- /dev/null
+++ b/src/test/cli/monmaptool/help.t
@@ -0,0 +1,10 @@
+ $ monmaptool --help
+ usage: monmaptool [--print] [--create [--clobber] [--fsid uuid]]
+ [--enable-all-features]
+ [--generate] [--set-initial-members]
+ [--add name 1.2.3.4:567] [--rm name]
+ [--feature-list [plain|parseable]]
+ [--feature-set <value> [--optional|--persistent]]
+ [--feature-unset <value> [--optional|--persistent]]
+ [--set-min-mon-release <release-major-number>]
+ <mapfilename>
diff --git a/src/test/cli/monmaptool/print-empty.t b/src/test/cli/monmaptool/print-empty.t
new file mode 100644
index 00000000..cd67db48
--- /dev/null
+++ b/src/test/cli/monmaptool/print-empty.t
@@ -0,0 +1,5 @@
+ $ touch empty
+ $ monmaptool --print empty
+ monmaptool: monmap file empty
+ monmaptool: unable to read monmap file
+ [255]
diff --git a/src/test/cli/monmaptool/print-nonexistent.t b/src/test/cli/monmaptool/print-nonexistent.t
new file mode 100644
index 00000000..ae366c1e
--- /dev/null
+++ b/src/test/cli/monmaptool/print-nonexistent.t
@@ -0,0 +1,4 @@
+ $ monmaptool --print nonexistent
+ monmaptool: monmap file nonexistent
+ monmaptool: couldn't open nonexistent: (2) No such file or directory
+ [255]
diff --git a/src/test/cli/monmaptool/rm-nonexistent.t b/src/test/cli/monmaptool/rm-nonexistent.t
new file mode 100644
index 00000000..ef680d85
--- /dev/null
+++ b/src/test/cli/monmaptool/rm-nonexistent.t
@@ -0,0 +1,25 @@
+ $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (1 monitors)
+
+ $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+
+ $ monmaptool --rm doesnotexist mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: removing doesnotexist
+ monmaptool: map does not contain doesnotexist
+ monmaptool -h for usage
+ [1]
+
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+ 0: v1:2.3.4.5:6789/0 mon.foo
+
+ $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+ $ [ "$ORIG_FSID" = "$NEW_FSID" ]
diff --git a/src/test/cli/monmaptool/rm.t b/src/test/cli/monmaptool/rm.t
new file mode 100644
index 00000000..5505320b
--- /dev/null
+++ b/src/test/cli/monmaptool/rm.t
@@ -0,0 +1,22 @@
+ $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ monmaptool: writing epoch 0 to mymonmap (1 monitors)
+
+ $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+
+ $ monmaptool --rm foo mymonmap
+ monmaptool: monmap file mymonmap
+ monmaptool: removing foo
+ monmaptool: writing epoch 0 to mymonmap (0 monitors)
+
+ $ monmaptool --print mymonmap
+ monmaptool: monmap file mymonmap
+ epoch 0
+ fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re)
+ last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re)
+ min_mon_release 0 (unknown)
+
+ $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)"
+ $ [ "$ORIG_FSID" = "$NEW_FSID" ]
diff --git a/src/test/cli/monmaptool/simple.t b/src/test/cli/monmaptool/simple.t
new file mode 100644
index 00000000..48c56911
--- /dev/null
+++ b/src/test/cli/monmaptool/simple.t
@@ -0,0 +1,3 @@
+ $ monmaptool
+ monmaptool: -h or --help for usage
+ [1]