diff options
author | Colin Walters <walters@verbum.org> | 2014-12-15 16:21:15 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2014-12-15 21:28:09 -0500 |
commit | f6a6e68412c9f1be2b5de1ded79b92aa340ab22c (patch) | |
tree | efa0d57f5a1ecbca09b72e3c4aa7c08f9cebebde /tests/test-remote-add.sh | |
parent | 8067e977a7280f3033406b208569464ffb630e92 (diff) | |
download | ostree-f6a6e68412c9f1be2b5de1ded79b92aa340ab22c.tar.gz |
Add more flexible _remote_change() API , expose via 'ostree remote'
For Anaconda, I needed OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
with the GFile *sysroot argument to avoid ugly hacks. We want to
write the content provided via "ostreesetup" as a remote to the target
chroot only in the case where it isn't provided as part of the tree
content itself.
This is also potentially useful in idempotent systems management tools
like Ansible.
https://bugzilla.gnome.org/show_bug.cgi?id=741577
Diffstat (limited to 'tests/test-remote-add.sh')
-rwxr-xr-x | tests/test-remote-add.sh | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/test-remote-add.sh b/tests/test-remote-add.sh index 65efdc1e..5e1a0eed 100755 --- a/tests/test-remote-add.sh +++ b/tests/test-remote-add.sh @@ -25,14 +25,26 @@ echo '1..3' setup_test_repository "bare" $OSTREE remote add origin http://example.com/ostree/gnome -echo "ok remote add" -assert_file_has_content $test_tmpdir/repo/config "example.com" +$OSTREE remote show-url origin >/dev/null echo "ok config" $OSTREE remote add --no-gpg-verify another http://another.com/repo -assert_file_has_content $test_tmpdir/repo/config "gpg-verify=false" +$OSTREE remote show-url another >/dev/null echo "ok remote no gpg-verify" +if $OSTREE remote add --no-gpg-verify another http://another.example.com/anotherrepo 2>err.txt; then + assert_not_reached "Adding duplicate remote unexpectedly succeeded" +fi +echo "ok" + +$OSTREE remote add --if-not-exists --no-gpg-verify another http://another.example.com/anotherrepo +$OSTREE remote show-url another >/dev/null +echo "ok" + +$OSTREE remote add --if-not-exists --no-gpg-verify another-noexist http://another-noexist.example.com/anotherrepo +$OSTREE remote show-url another-noexist >/dev/null +echo "ok" + $OSTREE remote delete another echo "ok remote delete" @@ -41,4 +53,18 @@ if $OSTREE remote delete nosuchremote 2>err.txt; then fi assert_file_has_content err.txt "error: " +$OSTREE remote delete --if-exists nosuchremote +echo "ok" +if $OSTREE remote show-url nosuchremote 2>/dev/null; then + assert_not_reached "Deleting remote unexpectedly failed" +fi +echo "ok" + +$OSTREE remote delete --if-exists origin +echo "ok" + +if $OSTREE remote show-url origin 2>/dev/null; then + assert_not_reached "Deleting remote unexpectedly failed" +fi +echo "ok" |