1
0
Fork 0

tests/beakerlib: Add new test which covers sysctl differently.

This commit is contained in:
Robin Hack 2024-01-31 08:27:59 -05:00
parent b15de12ec9
commit 0c52d474f0
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,24 @@
summary: Test for BZ#959732 (tuned ignores /etc/sysctl.d)
description: |
Bug summary: tuned ignores /etc/sysctl.d
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=959732
contact: rhack@redhat.com
component: []
framework: beakerlib
recommend:
- tuned
duration: 5m
enabled: true
tag:
- TIPpass
- Tier1
- TipWaived6
tier: '1'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=959732
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1103691
adjust:
- enabled: false
when: arch == s390x
continue: false
id: 38c4c3b1-d68d-451f-bdf9-5de27e4ea822

View file

@ -0,0 +1,60 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/tuned/Regression/bz959732-tuned-ignores-etc-sysctl-d
# Description: Test for BZ#959732 (tuned ignores /etc/sysctl.d)
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright Red Hat
#
# SPDX-License-Identifier: GPL-2.0-or-later WITH GPL-CC-1.0
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="tuned"
rlJournalStart
rlPhaseStartSetup
DEFAULT_PROFILE="balanced"
rlIsRHEL 6 && DEFAULT_PROFILE="default"
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart "tuned"
rlRun "mkdir -p /etc/sysctl.d"
rlRun "OLD_VALUE=$(sysctl -n fs.file-max)"
rlRun "NEW_VALUE=$(($OLD_VALUE-1))"
rlLog "Create file in /etc/sysctl.d/ with custom value"
rlRun "echo \"fs.file-max = $NEW_VALUE\" > /etc/sysctl.d/custom.conf"
rlPhaseEnd
rlPhaseStartTest
for profile in $(tuned-adm list | awk '/^-/ {print $2}')
do
rlLog "Profile: ${profile}"
rlRun "test $(sysctl -n fs.file-max) -eq $OLD_VALUE"
rlRun "tuned-adm profile ${profile}"
sleep 1
rlRun "test $(sysctl -n fs.file-max) -eq $NEW_VALUE"
rlRun "sysctl -w fs.file-max=$OLD_VALUE"
done
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore "tuned"
rlRun "sysctl fs.file-max=$OLD_VALUE"
rlRun "rm -rf /etc/sysctl.d/custom.conf"
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd