1
0
Fork 0

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

This commit is contained in:
Robin Hack 2024-01-31 07:35:06 -05:00
parent b15de12ec9
commit 73570386e4
2 changed files with 94 additions and 0 deletions

View file

@ -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 <rhack@redhat.com>
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

View file

@ -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 <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
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