Blame tests/test-admin-deploy-switch.sh

Packit Service 2a3f3d
#!/bin/bash
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# Copyright (C) 2011,2014 Colin Walters <walters@verbum.org>
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# SPDX-License-Identifier: LGPL-2.0+
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# This library is free software; you can redistribute it and/or
Packit Service 2a3f3d
# modify it under the terms of the GNU Lesser General Public
Packit Service 2a3f3d
# License as published by the Free Software Foundation; either
Packit Service 2a3f3d
# version 2 of the License, or (at your option) any later version.
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# This library is distributed in the hope that it will be useful,
Packit Service 2a3f3d
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 2a3f3d
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 2a3f3d
# Lesser General Public License for more details.
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# You should have received a copy of the GNU Lesser General Public
Packit Service 2a3f3d
# License along with this library; if not, write to the
Packit Service 2a3f3d
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit Service 2a3f3d
# Boston, MA 02111-1307, USA.
Packit Service 2a3f3d
Packit Service 2a3f3d
set -euo pipefail
Packit Service 2a3f3d
Packit Service 2a3f3d
. $(dirname $0)/libtest.sh
Packit Service 2a3f3d
Packit Service 2a3f3d
# Exports OSTREE_SYSROOT so --sysroot not needed.
Packit Service 2a3f3d
setup_os_repository "archive" "syslinux"
Packit Service 2a3f3d
Packit Service 2a3f3d
echo "1..4"
Packit Service 2a3f3d
Packit Service 2a3f3d
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo
Packit Service 2a3f3d
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
Packit Service 2a3f3d
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
Packit Service 2a3f3d
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
Packit Service 2a3f3d
assert_not_has_file sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h
Packit Service 2a3f3d
if ${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-runtime; then
Packit Service 2a3f3d
    assert_not_reached "Switch to same ref unexpectedly succeeded"
Packit Service 2a3f3d
fi
Packit Service 2a3f3d
echo "ok switch expected error"
Packit Service 2a3f3d
Packit Service 2a3f3d
${CMD_PREFIX} ostree admin switch --os=testos testos/buildmaster/x86_64-devel
Packit Service 2a3f3d
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-devel)
Packit Service 2a3f3d
assert_file_has_content sysroot/ostree/deploy/testos/deploy/$newrev.0/usr/include/foo.h 'header'
Packit Service 2a3f3d
Packit Service 2a3f3d
echo "ok switch"
Packit Service 2a3f3d
Packit Service 2a3f3d
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false anothertestos file://$(pwd)/testos-repo
Packit Service 2a3f3d
${CMD_PREFIX} ostree admin switch --os=testos anothertestos:testos/buildmaster/x86_64-devel
Packit Service 2a3f3d
# Ok this is lame, need a better shell command to extract config, or switch to gjs
Packit Service 2a3f3d
${CMD_PREFIX} ostree admin status > status.txt
Packit Service 2a3f3d
assert_file_has_content status.txt anothertestos
Packit Service 2a3f3d
Packit Service 2a3f3d
echo "ok switch remotes"
Packit Service 2a3f3d
Packit Service 2a3f3d
${CMD_PREFIX} ostree admin switch --os=testos testos:
Packit Service 2a3f3d
Packit Service 2a3f3d
echo "ok switch remote only"