diff options
author | Colin Walters <walters@verbum.org> | 2017-07-27 21:22:48 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-08-02 17:33:10 +0000 |
commit | d5273b34d0b4359aa668563528644061025e7ab1 (patch) | |
tree | 2c479c079789cc85d7268c431f3b80f331d1dec7 /tests/test-refs.sh | |
parent | d1eb909cd0a45246095d71f077c7e4cd4b5646fe (diff) | |
download | ostree-d5273b34d0b4359aa668563528644061025e7ab1.tar.gz |
lib/repo: Add API to create and list ref aliases
There are multiple use cases where we'd like to alias refs.
First, having a "stable" alias which gets swapped across major
versions: https://pagure.io/atomic-wg/issue/228
Another case is when a ref is obsoleted;
<https://pagure.io/atomic-wg/issue/303>
This second one could be done with endoflife rebase, but I think
this case is better on the server side, as we might later change
our minds and do actual releases there.
I initially just added some test cases for symlinks in the `refs/heads` dir to
ensure this actually works (and it did), but I think it's worth having APIs.
Closes: #1033
Approved by: jlebon
Diffstat (limited to 'tests/test-refs.sh')
-rwxr-xr-x | tests/test-refs.sh | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/test-refs.sh b/tests/test-refs.sh index d4db0013..e48784aa 100755 --- a/tests/test-refs.sh +++ b/tests/test-refs.sh @@ -23,7 +23,7 @@ set -euo pipefail setup_fake_remote_repo1 "archive-z2" -echo '1..1' +echo '1..2' cd ${test_tmpdir} mkdir repo @@ -117,3 +117,43 @@ ${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount.create6 assert_file_has_content refscount.create6 "^11$" echo "ok refs" + +# Test symlinking a ref +${CMD_PREFIX} ostree --repo=repo refs ctest --create=exampleos/x86_64/26/server +${CMD_PREFIX} ostree --repo=repo refs -A exampleos/x86_64/26/server --create=exampleos/x86_64/stable/server +${CMD_PREFIX} ostree --repo=repo summary -u +${CMD_PREFIX} ostree --repo=repo refs > refs.txt +for v in 26 stable; do + assert_file_has_content refs.txt exampleos/x86_64/${v}/server +done +${CMD_PREFIX} ostree --repo=repo refs -A > refs.txt +assert_file_has_content_literal refs.txt 'exampleos/x86_64/stable/server -> exampleos/x86_64/26/server' +assert_not_file_has_content refs.txt '^exampleos/x86_64/26/server' +stable=$(${CMD_PREFIX} ostree --repo=repo rev-parse exampleos/x86_64/stable/server) +current=$(${CMD_PREFIX} ostree --repo=repo rev-parse exampleos/x86_64/26/server) +assert_streq "${stable}" "${current}" +${CMD_PREFIX} ostree --repo=repo commit -b exampleos/x86_64/26/server --tree=dir=tree +${CMD_PREFIX} ostree --repo=repo summary -u +newcurrent=$(${CMD_PREFIX} ostree --repo=repo rev-parse exampleos/x86_64/26/server) +assert_not_streq "${newcurrent}" "${current}" +newstable=$(${CMD_PREFIX} ostree --repo=repo rev-parse exampleos/x86_64/stable/server) +assert_streq "${newcurrent}" "${newstable}" + +# Test that we can swap the symlink +${CMD_PREFIX} ostree --repo=repo commit -b exampleos/x86_64/27/server --tree=dir=tree +newcurrent=$(${CMD_PREFIX} ostree --repo=repo rev-parse exampleos/x86_64/27/server) +assert_not_streq "${newcurrent}" "${newstable}" +${CMD_PREFIX} ostree --repo=repo refs -A exampleos/x86_64/27/server --create=exampleos/x86_64/stable/server +newnewstable=$(${CMD_PREFIX} ostree --repo=repo rev-parse exampleos/x86_64/stable/server) +assert_not_streq "${newnewstable}" "${newstable}" +assert_streq "${newnewstable}" "${newcurrent}" +${CMD_PREFIX} ostree --repo=repo refs > refs.txt +for v in 26 27 stable; do + assert_file_has_content refs.txt exampleos/x86_64/${v}/server +done +${CMD_PREFIX} ostree --repo=repo refs -A > refs.txt +assert_file_has_content_literal refs.txt 'exampleos/x86_64/stable/server -> exampleos/x86_64/27/server' + +${CMD_PREFIX} ostree --repo=repo summary -u + +echo "ok ref symlink" |