Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/beakerlib/bz959732-tuned-ignores-etc-sysctl-d/main.fmf
Original file line number Diff line number Diff line change
@@ -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: [email protected]
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
60 changes: 60 additions & 0 deletions tests/beakerlib/bz959732-tuned-ignores-etc-sysctl-d/runtest.sh
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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
Loading