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 options. #592

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
summary: Test for BZ#1759597 (Settings in /usr/lib/sysctl.d take precedence over)
description: |
Bug summary: Settings in /usr/lib/sysctl.d take precedence over settings in tuned profiles in /etc/tuned.
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1759597
contact: Robin Hack <[email protected]>
component:
- tuned
framework: beakerlib
require:
- library(tuned/basic)
recommend:
- tuned
duration: 20m
enabled: true
tag:
- NoRHEL4
- NoRHEL5
- NoRHEL6
- NoRHEL7
- TIPpass_infra
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1759597
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1776149
adjust:
- enabled: false
when: distro == rhel-4, rhel-5, rhel-6, rhel-7
continue: false
- enabled: false
when: distro ~< rhel-8.2
continue: false
id: 1c91a928-72b9-407e-bf66-7a97025dc5cb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/tuned/Regression/Settings-in-usr-lib-sysctl-d-take-precedence-over
# Description: Test for BZ#1759597 (Settings in /usr/lib/sysctl.d take precedence over)
# 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
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlImport "tuned/basic"
tunedProfileBackup
rlServiceStart "tuned"

rlRun "ORIG_VAL=$(sysctl -n sysctl kernel.yama.ptrace_scope)"

rlAssertGrep "reapply_sysctl = 1" "/etc/tuned/tuned-main.conf"

rlRun "mkdir /etc/tuned/test-profile"
rlRun "pushd /etc/tuned/test-profile"
cat << EOF > tuned.conf
[sysctl]
kernel.yama.ptrace_scope=1
EOF
rlRun "popd"
rlPhaseEnd

rlPhaseStartTest
rlRun "VAL_STATE=$(sysctl -n kernel.yama.ptrace_scope)"
rlAssertEquals "val should be 0" "$VAL_STATE" "0"

rlRun "tuned-adm profile test-profile"

rlRun "VAL_STATE=$(sysctl -n kernel.yama.ptrace_scope)"
rlAssertEquals "val should be 1" "$VAL_STATE" "1"
rlPhaseEnd

rlPhaseStartCleanup
rlFileRestore
tunedProfileRestore
rlServiceRestore "tuned"

rlRun "sysctl -w kernel.yama.ptrace_scope=$ORIG_VAL"
rlRun "rm -rf /etc/tuned/test-profile"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
Loading