system-config/testinfra/test_mirror-update.py

73 lines
2.3 KiB
Python
Raw Normal View History

# Copyright 2019 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
testinfra_hosts = ['mirror-update01.opendev.org']
# Manually calculated from the "secret" value in the test host vars
KEYTAB_SHA256 = '88d4ac38ad3da024913843d8917d5be89ceac4abef7b977718f2c3f1db3ccde4'
def test_tools(host):
f = host.file('/usr/bin/k5start')
assert f.exists
f = host.file('/usr/bin/rsync')
assert f.exists
f = host.file('/usr/bin/vos')
assert f.exists
def test_rsync_scripts(host):
for script in ['centos',
'epel',
'fedora',
'opensuse',
'yum-puppetlabs']:
f = host.file('/usr/local/bin/%s-mirror-update' % script)
assert f.exists
def test_publisher_script(host):
f = host.file('/usr/local/bin/publish-mirror-logs')
assert f.exists
def test_keytabs(host):
for keytab in ['/etc/afsadmin.keytab',
'/etc/logs.keytab',
'/etc/centos.keytab',
'/etc/epel.keytab',
'/etc/fedora.keytab',
'/etc/opensuse.keytab',
'/etc/yum-puppetlabs.keytab']:
f = host.file(keytab)
assert f.exists
assert f.sha256sum == KEYTAB_SHA256
assert f.mode == 0o400
Allow for periodic afs releases from mirror-update This is a migration of the current periodic "vos release" script to mirror-update.opendev.org. The current script is deployed by puppet and run by a cron job on afsdb01.dfw.openstack.org. My initial motivation for this was wanting to better track our release of these various volumes. With tarballs and releases moving to AFS publishing, we are going to want to track the release process more carefully. Initially, I wanted to send timing statistics to graphite so we could build a dashboard and track the release times of all volumes. Because this requires an additional libraries and since we are deprecating puppet, further development there is unappealing and it would better live in ansible. Since I6c96f89c6f113362e6085febca70d58176f678e7 we have the ability to call "vos release" with "-localauth" permissions via ssh on mirror-update; this avoids various timeout issues (see the changelog comment there for more details). So we do not need to run this script directly on the afsdb server. We are alreadying publishing mirror update logs from mirror-update, and it would be good to also publish these release logs so anyone can see if there are problems. All this points to mirror-update.opendev.org being a good future home for this script. The script has been refactored some to - have a no-op mode - send timing stats for each volume release - call "vos release" via the ssh mecahnism we created - use an advisory lock to avoid running over itself It runs from a virtualenv and it's logs are published via the same mechanism as the mirror logs (slightly misnamed now). Note this script is currently a no-op to test the deployment, running and log publishing. A follow-up will disable the old job and make this active. Change-Id: I62ae941e70c7d58e00bc663a50d52e79dfa5a684
2020-02-06 04:16:23 +00:00
def test_afs_release_script(host):
f = host.file('/opt/afs-release/release-volumes.py')
assert f.exists
def test_afs_release_script_run(host):
# This will just run the command in a no-op mode to make sure deps
# are installed, etc.
cmd = host.run('/opt/afs-release/release-volumes.py '
'--debug --skip-release')
assert cmd.succeeded
def test_afsmon_installed(host):
f = host.file('/usr/local/bin/afsmon')
assert f.exists
f = host.file('/etc/afsmon.cfg')
assert f.exists