Skip to content

Commit

Permalink
beakerlibtests: add new test.
Browse files Browse the repository at this point in the history
  • Loading branch information
RHEmployee committed Oct 13, 2021
1 parent bcbf2a5 commit 5e5dd15
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/beakerlib/variables-support-in-profiles/main.fmf
@@ -0,0 +1,30 @@
summary: variables support in profiles
description: ''
contact: rhack@redhat.com
component:
- tuned
test: ./runtest.sh
framework: beakerlib
require:
- library(tuned/basic)
recommend:
- tuned
duration: 5m
enabled: true
tag:
- FedoraReady
- NoRHEL4
- NoRHEL5
- TIPfail_infra
- TIPpass
- Tier1
tier: '1'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1225124
adjust:
- enabled: false
when: distro < rhel-7
continue: false
extra-nitrate: TC#0496575
extra-summary: /CoreOS/tuned/Sanity/variables-support-in-profiles
extra-task: /CoreOS/tuned/Sanity/variables-support-in-profiles
62 changes: 62 additions & 0 deletions tests/beakerlib/variables-support-in-profiles/runtest.sh
@@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/tuned/Sanity/variables-support-in-profiles
# Description: variables support in profiles
# Author: Branislav Blaskovic <bblaskov@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
rlImport "tuned/basic"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart "tuned"
tunedProfileBackup
rlFileBackup "/usr/lib/tuned/balanced/tuned.conf"

echo "
[variables]
SWAPPINESS1 = 70
SWAPPINESS2 = \${SWAPPINESS1}
[sysctl]
vm.swappiness = \${SWAPPINESS2}
" >> /usr/lib/tuned/balanced/tuned.conf

rlRun "cat /usr/lib/tuned/balanced/tuned.conf"

OLD_SWAPPINESS=$(sysctl -n vm.swappiness)

rlPhaseEnd

rlPhaseStartTest
rlRun "tuned-adm profile balanced"
rlRun -s "sysctl -n vm.swappiness"
rlAssertGrep "70" "$rlRun_LOG"
rlPhaseEnd

rlPhaseStartCleanup
rlRun "sysctl vm.swappiness=$OLD_SWAPPINESS"
rlFileRestore
tunedProfileRestore
rlServiceRestore "tuned"
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

0 comments on commit 5e5dd15

Please sign in to comment.