rpm-ostree/tests/vmcheck/test-pinned-commit.sh
Colin Walters 27bd7b97bb Handle "pinned commits" specifically
There are a few scenarios today where one might deliver content
to a machine via an external transport.  For example, take the
scenario of a single server updated via USB drive.  While we
can provide a refspec...what should the remote be?  (This gets
into ostree collections).  There's nothing really that can
happen when typing `rpm-ostree upgrade` unless the USB stick
is plugged in.  That type of scenario should be emphasized
by pinning the commit - the machine is updated via an external
script.

Another case: we're experimenting embedding OSTree commits inside OCI
containers.  Here again since rpm-ostree can't understand how to
pull content from containers, it's saner to drop the refspec
bits, and pin to a commit.

Further enhancements will follow to make the admin experience more
obvious.

Closes: #1396
Approved by: jlebon
2018-06-11 20:37:58 +00:00

41 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (C) 2018 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -euo pipefail
. ${commondir}/libtest.sh
. ${commondir}/libvm.sh
set -x
checksum=$(vm_get_booted_csum)
vm_rpmostree rebase :${checksum}
vm_assert_status_jq ".deployments[0][\"origin\"] == \"${checksum}\""
vm_rpmostree status > status.txt
assert_file_has_content status.txt '^ ostree://'${checksum}
echo "ok pin to commit"
vm_rpmostree upgrade >out.txt
assert_file_has_content out.txt 'Pinned to commit; no upgrade available'
if vm_rpmostree deploy 42 2>err.txt; then
fatal "deployed version from commit?"
fi
assert_file_has_content err.txt 'Cannot look up version while pinned to commit'
echo "ok cmds"