Migrate to TMT-style gating in C9S

This is required for RHIVOS, see VROOM-23635.
This commit is contained in:
Frantisek Sumsal 2024-11-25 12:54:21 +01:00
parent 36c10becf4
commit e0200bae40
7 changed files with 28 additions and 271 deletions

10
ci.fmf
View File

@ -1,9 +1 @@
discover:
how: fmf
prepare:
how: install
exclude:
- libcurl-minimal
- curl-minimal
execute:
how: tmt
resultsdb-testcase: separate

View File

@ -1,6 +1,7 @@
--- !Policy
product_versions:
- rhel-9
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-internal/libcurl.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/tier1-internal/libcurl-minimal.functional}

24
plans.fmf Normal file
View File

@ -0,0 +1,24 @@
/tier1-internal:
discover:
how: fmf
filter: 'tag: Tier1 | tag: Tier2 | tag: Tier3 | tag: ExplicitCI'
url: https://gitlab.com/redhat/rhel/tests/curl.git
execute:
how: tmt
adjust:
enabled: false
when: distro == centos-stream or distro == fedora
/libcurl:
summary: internal test plan - libcurl
prepare:
how: install
exclude:
- libcurl-minimal
/libcurl-minimal:
summary: internal test plan - libcurl-minimal
prepare:
how: install
exclude:
- libcurl

View File

@ -1,18 +0,0 @@
summary: various download methods with non-root user
description: ''
contact: Daniel Rusek <drusek@redhat.com>
component:
- curl
require:
- findutils
- libselinux-utils
- openssh-clients
- openssh-server
- passwd
test: ./runtest.sh
framework: beakerlib
duration: 5m
enabled: true
tier: '1'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1049921

View File

@ -1,93 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/curl/Sanity/non-root-user-download
# Description: various download methods with non-root user
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="curl"
FTP_URL=ftp://ftp.fi.muni.cz/pub/linux/fedora/linux/releases/36/Everything/x86_64/iso/Fedora-Everything-36-1.5-x86_64-CHECKSUM
HTTP_URL=https://archives.fedoraproject.org/pub/fedora/linux/releases/36/Everything/x86_64/iso/Fedora-Everything-36-1.5-x86_64-CHECKSUM
CONTENT=85cb450443d68d513b41e57b0bd818a740279dac5dfc09c68e681ff8a3006404
PASSWORD=pAssw0rd
OPTIONS=""
rlIsRHEL 7 && OPTIONS="--insecure"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "useradd -m curltester" 0 "Adding the test user"
rlRun "echo $PASSWORD | passwd --stdin curltester" 0 "Setting the password for the test user"
rlRun "su - curltester -c 'echo $CONTENT > ~/testfile'" 0 "Creating ~curltester/testfile"
rlFileBackup --clean --missing-ok $HOME/.ssh /etc/hosts
rlRun "rm -f $HOME/.ssh/*"
[ -d $HOME/.ssh ] || ( mkdir $HOME/.ssh && restorecon HOME/.ssh )
rlRun "rlServiceStart sshd"
rlRun "ssh-keyscan localhost >> $HOME/.ssh/known_hosts"
rlPhaseEnd
rlPhaseStartTest "http download"
rlRun "su - curltester -c 'curl $HTTP_URL' &> http.log"
cat http.log
rlAssertGrep "$CONTENT" http.log
rlPhaseEnd
rlPhaseStartTest "ftp download"
rlRun "su - curltester -c 'curl $FTP_URL' &> ftp.log"
cat ftp.log
rlAssertGrep "$CONTENT" ftp.log
rlPhaseEnd
if ! rlIsRHEL 5; then
# scp sftp not supported on RHEL5
rlPhaseStartTest "scp download"
rlRun "curl -u curltester:$PASSWORD $OPTIONS scp://localhost/home/curltester/testfile &> scp.log"
cat scp.log
rlAssertGrep "$CONTENT" scp.log
rlPhaseEnd
rlPhaseStartTest "sftp download"
rlRun "curl -u curltester:$PASSWORD $OPTIONS sftp://localhost/home/curltester/testfile &> sftp.log"
cat sftp.log
rlAssertGrep "$CONTENT" sftp.log
rlPhaseEnd
fi
rlPhaseStartCleanup
rlRun "rlServiceRestore"
rlFileRestore
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "userdel -r --force curltester"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -1,20 +0,0 @@
summary: downloads test file through scp and sftp
description: |
Test scenario:
- scp download
- sftp download
- scp upload
- sftp upload
When PUBKEY_PARAM global variable is set to 'empty' or 'none', scenarios are executed
with empty --pubkey parameter (--pubkey "") or with the paramiter omitted
contact: Daniel Rusek <drusek@redhat.com>
require:
- findutils
component:
- curl
test: ./runtest.sh
path: /tests/scp-and-sftp-download-test
framework: beakerlib
duration: 10m
enabled: true

View File

@ -1,129 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/curl/Sanity/scp-and-sftp-download-test
# Description: downloads test file through scp and sftp
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="curl"
# GLOBAL/ENVIRONMENT VARIABLE:
# PUBKEY_PARAM
if [ "$PUBKEY_PARAM" == 'none' ]; then
PUBKEY_PARAM=""
elif [ "$PUBKEY_PARAM" == 'empty' ]; then
PUBKEY_PARAM="--pubkey ''"
else
PUBKEY_PARAM='--pubkey /root/.ssh/id_rsa.pub'
fi
FILESIZE=200 #MB
OPTIONS=""
rlIsRHEL 7 && OPTIONS="--insecure"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlFileBackup --clean /root/.ssh/known_hosts /root/.ssh
rlFileBackup --clean /etc/ssh/sshd_config
rlRun "useradd -m curltestuser"
# In FIPS-140 we need to explicitly allow one of libssh2-implemented
# Kex algorithms (eg. DH14-SHA1).
rlRun "echo 'KexAlgorithms +diffie-hellman-group14-sha1' >> /etc/ssh/sshd_config" 0
rlServiceStop "sshd"
rlRun "service sshd start && sleep 5" 0
# file for download test
rlRun "su - curltestuser -c 'dd if=/dev/zero of=testfile bs=1M count=200'" 0 "Creating $FILESIZE MB large test file"
SUM=`sha256sum /home/curltestuser/testfile | cut -d ' ' -f 1`
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "rm -vf /root/.ssh/*"
rlRun "ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ''" 0 "Generate ssh key"
rlRun "mkdir /home/curltestuser/.ssh && cat /root/.ssh/id_rsa.pub > /home/curltestuser/.ssh/authorized_keys && chown -R curltestuser.curltestuser /home/curltestuser/.ssh/" 0 "Save the key to .ssh/authorized_keys"
# this is a workaround as libssh2 is not able to use newer hashes
#rlRun "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/root/.ssh/known_hosts curltestuser@localhost 'exit'" 0 "First ssh login to add localhost to known_hosts"
rlRun "ssh-keyscan localhost >>/root/.ssh/known_hosts"
# files for upload test
rlRun "dd if=/dev/zero of=uploadfile1 bs=1M count=50" 0 "Creating 50 MB large test file"
UPSUM1=`sha256sum uploadfile1 | cut -d ' ' -f 1`
rlRun "dd if=/dev/zero of=uploadfile2 bs=1M count=20" 0 "Creating 20 MB large test file"
UPSUM2=`sha256sum uploadfile2 | cut -d ' ' -f 1`
rlPhaseEnd
rlPhaseStartTest "scp download test"
rlRun "curl -o ./scp_file -u curltestuser: --key /root/.ssh/id_rsa $PUBKEY_PARAM $OPTIONS scp://localhost/home/curltestuser/testfile" 0 "Initiate curl scp download"
rlAssertExists scp_file
SCPSUM=`sha256sum ./scp_file | cut -d ' ' -f 1`
rlAssertEquals "Checking that whole file was properly downloaded" $SUM $SCPSUM
rm -f ./scp_file
rlPhaseEnd
rlPhaseStartTest "sftp download test"
rlRun "curl -o ./sftp_file -u curltestuser: --key /root/.ssh/id_rsa $PUBKEY_PARAM $OPTIONS sftp://localhost/home/curltestuser/testfile" 0 "Initiate curl scp download"
rlAssertExists sftp_file
SFTPSUM=`sha256sum ./sftp_file | cut -d ' ' -f 1`
rlAssertEquals "Checking that whole file was properly downloaded" $SUM $SFTPSUM
rm -f ./sftp_file
rlPhaseEnd
rlPhaseStartTest "scp upload test"
rlRun "curl -T '{uploadfile1,uploadfile2}' scp://localhost/home/curltestuser/ -u curltestuser: --key /root/.ssh/id_rsa $PUBKEY_PARAM $OPTIONS" 0 "Initiate curl scp upload"
rlAssertExists /home/curltestuser/uploadfile1
rlAssertExists /home/curltestuser/uploadfile2
SCPUPSUM1=`sha256sum /home/curltestuser/uploadfile1 | cut -d ' ' -f 1`
SCPUPSUM2=`sha256sum /home/curltestuser/uploadfile2 | cut -d ' ' -f 1`
rlAssertEquals "Checking that 1st file was properly uploaded" ${UPSUM1} ${SCPUPSUM1}
rlAssertEquals "Checking that 2nd file was properly uploaded" ${UPSUM2} ${SCPUPSUM2}
rm -f /home/curltestuser/uploadfile1 /home/curltestuser/uploadfile2
rlPhaseEnd
rlPhaseStartTest "sftp upload test"
rlRun "curl -T '{uploadfile1,uploadfile2}' sftp://localhost/home/curltestuser/ -u curltestuser: --key /root/.ssh/id_rsa $PUBKEY_PARAM $OPTIONS" 0 "Initiate curl sftp upload"
rlAssertExists /home/curltestuser/uploadfile1
rlAssertExists /home/curltestuser/uploadfile2
SFTPUPSUM1=`sha256sum /home/curltestuser/uploadfile1 | cut -d ' ' -f 1`
SFTPUPSUM2=`sha256sum /home/curltestuser/uploadfile2 | cut -d ' ' -f 1`
rlAssertEquals "Checking that 1st file was properly uploaded" ${UPSUM1} ${SFTPUPSUM1}
rlAssertEquals "Checking that 2nd file was properly uploaded" ${UPSUM2} ${SFTPUPSUM2}
rm -f /home/curltestuser/uploadfile1 /home/curltestuser/uploadfile2
rlPhaseEnd
rlPhaseStartCleanup
rlRun "userdel -r --force curltestuser"
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlFileRestore
rlServiceRestore "sshd"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd