summaryrefslogtreecommitdiff
path: root/tests/test-config.sh
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2019-02-28 16:19:41 -0800
committerAtomic Bot <atomic-devel@projectatomic.io>2019-03-01 16:29:44 +0000
commitcfc6046689f828cff4f914fdddb1350f7b576f42 (patch)
tree22d0351b3a434eb45f0da30ce31de7d4ec063621 /tests/test-config.sh
parent656853a98aac0e96167602cbfa2f835890679304 (diff)
downloadostree-cfc6046689f828cff4f914fdddb1350f7b576f42.tar.gz
ostree/config: Check for too many args
Currently it's not an error to provide too many arguments to an ostree config command. Change it so we print usage information in that case, and update the unit tests. Closes: #1743 Approved by: cgwalters
Diffstat (limited to 'tests/test-config.sh')
-rwxr-xr-xtests/test-config.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test-config.sh b/tests/test-config.sh
index 62f63006..b98f8d47 100755
--- a/tests/test-config.sh
+++ b/tests/test-config.sh
@@ -41,6 +41,12 @@ assert_file_has_content list.txt "1"
assert_file_has_content list.txt "Flathub"
assert_file_has_content list.txt "true"
assert_file_has_content list.txt "http://example.com/ostree/repo/"
+
+# Check that it errors out if too many arguments are given
+if ${CMD_PREFIX} ostree config --repo=repo get --group=core lock-timeout-secs extra 2>err.txt; then
+ assert_not_reached "ostree config get should error out if too many arguments are given"
+fi
+assert_file_has_content err.txt "error: Too many arguments given"
echo "ok config get"
${CMD_PREFIX} ostree config --repo=repo set core.mode bare-user-only
@@ -52,6 +58,12 @@ assert_file_has_content repo/config "bare-user-only"
assert_file_has_content repo/config "Nightly Flathub"
assert_file_has_content repo/config "false"
assert_file_has_content repo/config "http://example.com/ostree/"
+
+# Check that it errors out if too many arguments are given
+if ${CMD_PREFIX} ostree config --repo=repo set --group=core lock-timeout-secs 120 extra 2>err.txt; then
+ assert_not_reached "ostree config set should error out if too many arguments are given"
+fi
+assert_file_has_content err.txt "error: Too many arguments given"
echo "ok config set"
# Check that "ostree config unset" works
@@ -76,4 +88,10 @@ ${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.ti
# Check that the key doesn't need to exist
${CMD_PREFIX} ostree config --repo=repo set --group='remote "aoeuhtns"' 'xa.title-is-set' 'false'
${CMD_PREFIX} ostree config --repo=repo unset --group='remote "aoeuhtns"' 'xa.title'
+
+# Check that it errors out if too many arguments are given
+if ${CMD_PREFIX} ostree config --repo=repo unset core.lock-timeout-secs extra 2>err.txt; then
+ assert_not_reached "ostree config unset should error out if too many arguments are given"
+fi
+assert_file_has_content err.txt "error: Too many arguments given"
echo "ok config unset"