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

Packit Service 2a3f3d
#!/bin/bash
Packit Service 2a3f3d
#
Packit Service 2a3f3d
# Copyright (C) 2019 Robert Fairley <rfairley@redhat.com>
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" "sysroot.bootloader none"
Packit Service 2a3f3d
Packit Service 2a3f3d
extra_admin_tests=1
Packit Service 2a3f3d
Packit Service 2a3f3d
. $(dirname $0)/admin-test.sh
Packit Service 2a3f3d
Packit Service 2a3f3d
# Test that the bootloader configuration "none" generates BLS config snippets.
Packit Service 2a3f3d
cd ${test_tmpdir}
Packit Service 2a3f3d
rm httpd osdata testos-repo sysroot -rf
Packit Service 2a3f3d
setup_os_repository "archive" "sysroot.bootloader none"
Packit Service 2a3f3d
${CMD_PREFIX} ostree pull-local --repo=sysroot/ostree/repo --remote testos testos-repo testos/buildmaster/x86_64-runtime
Packit Service 2a3f3d
# Test that configuring sysroot.bootloader="none" is a workaround for previous
Packit Service 2a3f3d
# grub2 bootloader issue (see https://github.com/ostreedev/ostree/issues/1774)
Packit Service 2a3f3d
mkdir -p sysroot/boot/grub2
Packit Service 2a3f3d
touch sysroot/boot/grub2/grub.cfg
Packit Service 2a3f3d
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos testos/buildmaster/x86_64-runtime > out.txt
Packit Service 2a3f3d
assert_file_has_content out.txt "Bootloader updated.*"
Packit Service 2a3f3d
assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO'
Packit Service 2a3f3d
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel'
Packit Service 2a3f3d
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/.vmlinuz-3.6.0.hmac  'an hmac file'
Packit Service 2a3f3d
assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs'
Packit Service 2a3f3d
echo "ok generate bls config on first deployment"
Packit Service 2a3f3d
Packit Service 2a3f3d
# TODO: add tests to try setting with an unsupported bootloader config,
Packit Service 2a3f3d
# once https://github.com/ostreedev/ostree/issues/1827 is solved.
Packit Service 2a3f3d
# The tests should check that the following commands fail:
Packit Service 2a3f3d
#  ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader unsupported_bootloader
Packit Service 2a3f3d
#  ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootloader ""