diff --git a/Sanity/ncat-smoke-test/main.fmf b/Sanity/ncat-smoke-test/main.fmf new file mode 100644 index 0000000..6cfa69c --- /dev/null +++ b/Sanity/ncat-smoke-test/main.fmf @@ -0,0 +1,21 @@ +summary: Basic ncat functional test +description: '' +enabled: true +tag: + - Tier1 +tier: '1' +adjust: + - enabled: false + when: distro < rhel-6 + continue: false +contact: fhrdina@redhat.com +component: + - nmap +test: ./runtest.sh +framework: beakerlib +recommend: + - nmap +duration: 10m +extra-nitrate: TC#0608152 +extra-summary: /CoreOS/nmap/Sanity/ncat-smoke-test +extra-task: /CoreOS/nmap/Sanity/ncat-smoke-test diff --git a/Sanity/ncat-smoke-test/runtest.sh b/Sanity/ncat-smoke-test/runtest.sh new file mode 100755 index 0000000..d44c9dd --- /dev/null +++ b/Sanity/ncat-smoke-test/runtest.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/nmap/Sanity/ncat-smoke-test +# Description: Basic ncat functional test +# Author: Stanislav Zidek +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 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="nmap" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "ncat -vl 6666 &>srv.log &" + srv_pid=$! + rlRun "rlWaitForSocket -t 5 6666" + rlRun "echo CONNECTED |ncat --send-only localhost 6666" + rlRun "rlWaitForSocket --close -t 5 6666" + rlRun "ps --no-headers -fp $srv_pid" 1 "Server finished" + rc=$? + if [[ $rc -ne 1 ]]; then + rlRun "kill -9 $srv_pid" + fi + rlAssertGrep "CONNECTED" srv.log + rlGetPhaseState || rlRun "cat srv.log" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd