Adding fmf plan and test

/CoreOS/mailcap/Sanity/basic
This commit is contained in:
František Hrdina 2023-04-03 14:49:23 +02:00
commit 90d897bd3e
6 changed files with 134 additions and 0 deletions

21
Sanity/basic/mail Normal file
View file

@ -0,0 +1,21 @@
From root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com Fri Jun 21 06:16:44 2019
Return-Path: <root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com>
X-Original-To: root
Delivered-To: root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com
Received: by ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com (Postfix, from userid 0)
id 881FF200019C; Fri, 21 Jun 2019 06:16:36 -0400 (EDT)
Date: Fri, 21 Jun 2019 06:16:36 -0400
To: root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com
Subject: lala
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20190621101644.881FF200019C@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com>
From: root <root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com>
Status: RO
lsdlsl

24
Sanity/basic/main.fmf Normal file
View file

@ -0,0 +1,24 @@
summary: Basic sanity test
description: ''
contact: fhrdina@redhat.com
component:
- mailcap
test: ./runtest.sh
framework: beakerlib
recommend:
- mailcap
- mutt
- expect
duration: 20m
enabled: true
tag:
- Tier1
tier: '1'
adjust:
- enabled: false
when: distro < rhel-8
continue: false
extra-nitrate: TC#0601873
extra-summary: /CoreOS/mailcap/Sanity/basic
extra-task: /CoreOS/mailcap/Sanity/basic
id: 82030add-7735-45f6-b211-d90f8747605a

8
Sanity/basic/mutt.exp Normal file
View file

@ -0,0 +1,8 @@
spawn mutt
expect "q:Quit" {
sleep 2
send "\r"; send "qq";
}
interact

4
Sanity/basic/run-test.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
rm -rf /tmp/testing
echo "123 hello world We are here" > /tmp/testing

72
Sanity/basic/runtest.sh Executable file
View file

@ -0,0 +1,72 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/mailcap/Sanity/basic
# Description: Basic sanity test
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="mailcap"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlFileBackup "/var/mail/root"
rlRun "cat ./mail > /var/mail/root"
rlRun "cat ./run-test.sh > /usr/local/bin/run-test.sh"
rlRun "chmod +x /usr/local/bin/run-test.sh"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp ./mutt.exp $TmpDir"
rlRun "pushd $TmpDir"
rlRun "echo 'text/html; /usr/local/bin/run-test.sh %s; copiousoutput' > /root/.mailcap"
rlRun "echo 'auto_view text/html' > /root/.muttrc"
rlRun "mkdir /root/Mail/" 0-255
rlRun "rm -rf /tmp/testing"
rlPhaseEnd
rlPhaseStartTest
rlRun "script -qfec 'expect -f ./mutt.exp'"
rlAssertGrep "123 hello world We are here" /tmp/testing
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "rm -rf /usr/local/bin/run-test.sh"
rlRun "rm -rf /root/.mailcap"
rlRun "rm -rf /root/.muttrc"
rlRun "rm -rf /tmp/testing"
rlFileRestore
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

5
plans/all.fmf Normal file
View file

@ -0,0 +1,5 @@
summary: Run all tests
discover:
how: fmf
execute:
how: tmt