summaryrefslogtreecommitdiffstats
path: root/cts/cts-cli.in
diff options
context:
space:
mode:
Diffstat (limited to 'cts/cts-cli.in')
-rwxr-xr-xcts/cts-cli.in56
1 files changed, 54 insertions, 2 deletions
diff --git a/cts/cts-cli.in b/cts/cts-cli.in
index fdad002..f4cb7c3 100755
--- a/cts/cts-cli.in
+++ b/cts/cts-cli.in
@@ -1,6 +1,6 @@
#!@BASH_PATH@
#
-# Copyright 2008-2022 the Pacemaker project contributors
+# Copyright 2008-2023 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
@@ -143,7 +143,7 @@ function _test_assert() {
target=$1; shift
validate=$1; shift
cib=$1; shift
- app=`echo "$cmd" | sed 's/\ .*//'`
+ app=$(echo "$cmd" | head -n 1 | sed 's/\ .*//')
printf "* Running: $app - $desc\n" 1>&2
printf "=#=#=#= Begin test: $desc =#=#=#=\n"
@@ -2289,6 +2289,53 @@ function test_tools() {
desc="Switch to nonexistent shadow instance (force) (XML)"
cmd="crm_shadow --switch $shadow --batch --force --output-as=xml"
test_assert_validate $CRM_EX_NOSUCH 0
+
+ CIB_file_invalid_1="$test_home/cli/crm_verify_invalid_bz.xml"
+ CIB_file_invalid_2="$test_home/cli/crm_verify_invalid_no_stonith.xml"
+
+ desc="Verify a file-specified invalid configuration, outputting as xml"
+ cmd="crm_verify --xml-file '$CIB_file_invalid_1' --output-as=xml"
+ test_assert_validate $CRM_EX_CONFIG 0
+
+ desc="Verify another file-specified invalid configuration, outputting as xml"
+ cmd="crm_verify --xml-file '$CIB_file_invalid_2' --output-as=xml"
+ test_assert_validate $CRM_EX_CONFIG 0
+
+ desc="Verbosely verify a file-specified invalid configuration, outputting as xml"
+ cmd="crm_verify --xml-file '$CIB_file_invalid_1' --output-as=xml --verbose"
+ test_assert_validate $CRM_EX_CONFIG 0
+
+ desc="Verbosely verify another file-specified invalid configuration, outputting as xml"
+ cmd="crm_verify --xml-file '$CIB_file_invalid_2' --output-as=xml --verbose"
+ test_assert_validate $CRM_EX_CONFIG 0
+
+ export CIB_file="$test_home/cli/crm_mon.xml"
+
+ desc="Verify a file-specified valid configuration, outputting as xml"
+ cmd="crm_verify --xml-file '$CIB_file' --output-as=xml"
+ test_assert_validate $CRM_EX_OK 0
+
+ desc="Verify a piped-in valid configuration, outputting as xml"
+ cmd="cat '$CIB_file' | crm_verify -p --output-as=xml"
+ test_assert_validate $CRM_EX_OK 0
+
+ desc="Verbosely verify a file-specified valid configuration, outputting as xml"
+ cmd="crm_verify --xml-file '$CIB_file' --output-as=xml --verbose"
+ test_assert_validate $CRM_EX_OK 0
+
+ desc="Verbosely verify a piped-in valid configuration, outputting as xml"
+ cmd="cat '$CIB_file' | crm_verify -p --output-as=xml --verbose"
+ test_assert_validate $CRM_EX_OK 0
+
+ CIB_file_contents=$(cat "$CIB_file")
+
+ desc="Verify a string-supplied valid configuration, outputting as xml"
+ cmd="crm_verify -X '$CIB_file_contents' --output-as=xml"
+ test_assert_validate $CRM_EX_OK 0
+
+ desc="Verbosely verify a string-supplied valid configuration, outputting as xml"
+ cmd="crm_verify -X '$CIB_file_contents' --output-as=xml --verbose"
+ test_assert_validate $CRM_EX_OK 0
unset CIB_file
unset CIB_shadow
@@ -3382,6 +3429,11 @@ function print_or_remove_file() {
rm -f "$TMPFILE"
else
echo " $TMPFILE"
+ if [ $verbose -ne 0 ]; then
+ echo "======================================================"
+ cat "$TMPFILE"
+ echo "======================================================"
+ fi
fi
}