system-config/testinfra/test_mirror-update.py
Ian Wienand aa357fc19f mirror-update: update keytab testing
Keytabs are slightly longer than what is being tested; upto 100 bytes
or so.  This means the encoded data breaks over lines, which means you
need to be more careful about quoting.

Update the testing to a longer keytab (100 bytes of random data) and
fix up the quoting.  Also enable no_logging to avoid putting key
material into the logs.

Change-Id: I73c391a2ebd2c962dc9a422f9d44265160210852
2019-07-02 17:17:20 +10:00

51 lines
1.6 KiB
Python

# 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_keytabs(host):
for keytab in ['/etc/afsadmin.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