[DNM] Gate test
Change-Id: I79860f90d1581624a4c75093363cf92d5f0493d1
This commit is contained in:
parent
30200a54d9
commit
1a08905176
@ -72,6 +72,7 @@
|
||||
run: tools/gate/playbooks/osh-infra-gate-runner.yaml
|
||||
vars:
|
||||
zuul_osh_infra_relative_path: ../../openstack/openstack-helm-infra/
|
||||
gate_scripts_relative_path: ""
|
||||
gate_scripts:
|
||||
- "{{ zuul_osh_infra_relative_path }}./tools/deployment/apparmor/001-setup-apparmor-profiles.sh"
|
||||
- "{{ zuul_osh_infra_relative_path }}./tools/deployment/common/005-deploy-k8s.sh"
|
||||
|
@ -29,7 +29,7 @@ fi
|
||||
DEFAULT_IFS=$IFS
|
||||
|
||||
NAME=divingbell
|
||||
: ${LOGS_DIR:=/tmp/artifacts}
|
||||
: ${LOGS_DIR:=/tmp/logs/system/artifacts}
|
||||
: ${LOGS_SUBDIR:=${LOGS_DIR}/${NAME}/$(date +"%m-%d-%y_%H:%M:%S")}
|
||||
mkdir -p "${LOGS_SUBDIR}"
|
||||
LOG_NAME="${LOGS_SUBDIR}/test.log"
|
||||
@ -450,13 +450,16 @@ get_container_status(){
|
||||
local container_runtime_sleep_interval=5
|
||||
wait_time=0
|
||||
while : ; do
|
||||
# don't echo out the entire log every time - it's bogging everything down
|
||||
set +x
|
||||
CLOGS="$(kubectl logs --namespace="${NAME}" "${container}" 2>&1)" || true
|
||||
# the test below now looks at the last ten lines of the log rather than
|
||||
# just the last line, since there are cases where other things have to get
|
||||
# logged after the error / success message.
|
||||
# also: trying printf here to avoid arcane SIGTERM/SIGPIPE problems with
|
||||
# builtin echo.
|
||||
status="$(printf '%s' "${CLOGS}" | tail -n 10)"
|
||||
status="$(echo -e ${CLOGS} | tail -n 10)"
|
||||
set -x
|
||||
if [[ $(echo -e ${status} | tr -d '[:cntrl:]') = *ERROR* ]] ||
|
||||
[[ $(echo -e ${status} | tr -d '[:cntrl:]') = *TRACE* ]]; then
|
||||
if [ "${2}" = 'expect_failure' ]; then
|
||||
@ -493,6 +496,11 @@ get_container_status(){
|
||||
done
|
||||
}
|
||||
|
||||
_dump_pod_log_on_secondary_fail(){
|
||||
echo '[FAIL] pod logs:' >> "${TEST_RESULTS}"
|
||||
printf '%s' "${CLOGS}" >> "${TEST_RESULTS}"
|
||||
}
|
||||
|
||||
_test_sysctl_default(){
|
||||
if [ "$(/sbin/sysctl "${1}" | cut -d'=' -f2 | tr -d '[:space:]')" != "${2}" ]; then
|
||||
echo "[FAIL] Expected kernel parameter ${1} to be set to ${2}, but it was not." >> "${TEST_RESULTS}"
|
||||
@ -1266,16 +1274,19 @@ _test_apt_package_version(){
|
||||
if [ "${pkg_ver}" = "none" ]; then
|
||||
# Does not include residual-config
|
||||
if [ -n "$(dpkg -l | grep ${pkg_name} | grep -v ^rc)" ]; then
|
||||
_dump_pod_log_on_secondary_fail
|
||||
echo "[FAIL] Expected package ${pkg_name} not to be installed, but it was." >> "${TEST_RESULTS}"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "${pkg_ver}" = "any" ]; then
|
||||
if [ -z "$(dpkg -l | grep ${pkg_name})" ]; then
|
||||
_dump_pod_log_on_secondary_fail
|
||||
echo "[FAIL] Expected package ${pkg_name} to be installed, but it wasn't." >> "${TEST_RESULTS}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [ $(dpkg -l | awk "/[[:space:]]${pkg_name}[[:space:]]/"'{print $3}') != "${pkg_ver}" ]; then
|
||||
_dump_pod_log_on_secondary_fail
|
||||
echo "[FAIL] Expected package ${pkg_name} version ${pkg_ver} to be installed, but it wasn't." >> "${TEST_RESULTS}"
|
||||
exit 1
|
||||
fi
|
||||
@ -1510,20 +1521,20 @@ $APT_ALL_INSTALLED_PACKAGES
|
||||
_test_apt_package_version $APT_PACKAGE4 any
|
||||
echo '[SUCCESS] apt test10 passed successfully' >> "${TEST_RESULTS}"
|
||||
|
||||
# Test removing a package in strict mode
|
||||
local overrides_yaml=${LOGS_SUBDIR}/${FUNCNAME[0]}-set10.yaml
|
||||
# using the same APT_ALL_INSTALLED_PACKAGES from above,
|
||||
# which does NOT have APT_PACKAGE1
|
||||
echo "conf:
|
||||
apt:
|
||||
strict: true
|
||||
$APT_ALL_INSTALLED_PACKAGES" > "${overrides_yaml}"
|
||||
install_base "--values=${overrides_yaml}"
|
||||
get_container_status apt
|
||||
_test_apt_package_version $APT_PACKAGE1 none
|
||||
# PACKAGE4 used earlier is intended to be a package that is always installed
|
||||
_test_apt_package_version $APT_PACKAGE4 any
|
||||
echo '[SUCCESS] apt test11 passed successfully' >> "${TEST_RESULTS}"
|
||||
# # Test removing a package in strict mode
|
||||
# local overrides_yaml=${LOGS_SUBDIR}/${FUNCNAME[0]}-set10.yaml
|
||||
# # using the same APT_ALL_INSTALLED_PACKAGES from above,
|
||||
# # which does NOT have APT_PACKAGE1
|
||||
# echo "conf:
|
||||
# apt:
|
||||
# strict: true
|
||||
#$APT_ALL_INSTALLED_PACKAGES" > "${overrides_yaml}"
|
||||
# install_base "--values=${overrides_yaml}"
|
||||
# get_container_status apt
|
||||
# _test_apt_package_version $APT_PACKAGE1 none
|
||||
# # PACKAGE4 used earlier is intended to be a package that is always installed
|
||||
# _test_apt_package_version $APT_PACKAGE4 any
|
||||
# echo '[SUCCESS] apt test11 passed successfully' >> "${TEST_RESULTS}"
|
||||
}
|
||||
|
||||
# test exec module
|
||||
@ -2325,16 +2336,16 @@ init_default_state
|
||||
|
||||
# run tests
|
||||
if [[ -z $SKIP_BASE_TESTS ]]; then
|
||||
install_base
|
||||
test_sysctl
|
||||
test_limits
|
||||
test_perm
|
||||
test_mounts
|
||||
test_ethtool
|
||||
test_uamlite
|
||||
# install_base
|
||||
# test_sysctl
|
||||
# test_limits
|
||||
# test_perm
|
||||
# test_mounts
|
||||
# test_ethtool
|
||||
# test_uamlite
|
||||
test_apt
|
||||
test_exec
|
||||
test_apparmor
|
||||
# test_exec
|
||||
# test_apparmor
|
||||
fi
|
||||
purge_containers
|
||||
test_overrides
|
||||
|
Loading…
Reference in New Issue
Block a user