diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/tier1.fmf b/plans/tier1.fmf new file mode 100644 index 0000000..3aa33db --- /dev/null +++ b/plans/tier1.fmf @@ -0,0 +1,7 @@ +summary: CI plan with Tier1 beakerlib tests +discover: + how: fmf + url: https://src.fedoraproject.org/tests/httpd.git + filter: 'tier: 1' +execute: + how: tmt diff --git a/tests/httpd-php-mysql-sanity-test/PURPOSE b/tests/httpd-php-mysql-sanity-test/PURPOSE deleted file mode 100644 index 59b3931..0000000 --- a/tests/httpd-php-mysql-sanity-test/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/httpd/Sanity/httpd-php-mysql-sanity-test -Description: test fetching data from mysqldb/mariadb through php -Author: Karel Srot diff --git a/tests/httpd-php-mysql-sanity-test/new_mysql.php b/tests/httpd-php-mysql-sanity-test/new_mysql.php deleted file mode 100644 index 6087b11..0000000 --- a/tests/httpd-php-mysql-sanity-test/new_mysql.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/tests/httpd-php-mysql-sanity-test/old_mysql.php b/tests/httpd-php-mysql-sanity-test/old_mysql.php deleted file mode 100644 index 8904c58..0000000 --- a/tests/httpd-php-mysql-sanity-test/old_mysql.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/tests/httpd-php-mysql-sanity-test/php_mysql_test.conf b/tests/httpd-php-mysql-sanity-test/php_mysql_test.conf deleted file mode 100644 index d03c3c3..0000000 --- a/tests/httpd-php-mysql-sanity-test/php_mysql_test.conf +++ /dev/null @@ -1,5 +0,0 @@ - -Alias /php_mysql_test /var/www/php_mysql_test - - - diff --git a/tests/httpd-php-mysql-sanity-test/php_mysql_test.sql b/tests/httpd-php-mysql-sanity-test/php_mysql_test.sql deleted file mode 100644 index ad931ac..0000000 --- a/tests/httpd-php-mysql-sanity-test/php_mysql_test.sql +++ /dev/null @@ -1,6 +0,0 @@ - -CREATE DATABASE php_mysql_test; -USE php_mysql_test; - -CREATE TABLE foobar (name VARCHAR(10), value INTEGER); -INSERT INTO foobar VALUES("fish", 42); diff --git a/tests/httpd-php-mysql-sanity-test/runtest.sh b/tests/httpd-php-mysql-sanity-test/runtest.sh deleted file mode 100755 index 6fa8315..0000000 --- a/tests/httpd-php-mysql-sanity-test/runtest.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/httpd/Sanity/httpd-php-mysql-sanity-test -# Description: test fetching data from mysqldb/mariadb through php -# Author: Karel Srot -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# 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 -[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGES="${PACKAGES:-httpd}" -REQUIRES="${REQUIRES:-php $DB}" - -rlJournalStart - rlPhaseStartSetup - rlRun "rlImport httpd/http" 0 "Import httpd library" - if rlIsRHEL 5 6 && [ $httpCOLLECTION = 0 ]; then - DB="mysql-server" - rlRun "rlImport mysql/basic" 0 "Import mysqld library" - SERVICE=${mysqlServiceName} - else - DB="mariadb-server" - rlRun "rlImport mariadb55/basic" 0 "Import mariadb library" - SERVICE=${mariadbServiceName} - fi - # install also php-mysql on rhel-6 (instead of php-mysqlnd on rhel-7) - rlRun "rlImport php/utils" - phpPdoPhpMysqlSetup - rlAssertRpm --all - rlRun "rlServiceStart $SERVICE" 0 - rlRun "echo DROP DATABASE php_mysql_test | mysql -u root" 0,1 - rlRun "mysql --verbose -u root < php_mysql_test.sql" - rlRun "httpStop" 0 "Stop httpd if running" - rlRun "> $httpLOGDIR/error_log" - rlRun "rm -rvf $httpROOTDIR/php_mysql_test" - rlRun "mkdir -v $httpROOTDIR/php_mysql_test" - rlRun "cp -v php_mysql_test.conf $httpCONFDIR/conf.d/" - php_version=`rlCheckRpm php` - if [[ $php_version =~ php-7* ]] || [[ $php_version =~ php-5.[5-6]* ]]; then - rlRun "cp -v new_mysql.php $httpROOTDIR/php_mysql_test/mysql.php" - else - rlRun "cp -v old_mysql.php $httpROOTDIR/php_mysql_test/mysql.php" - fi - rlRun "sed -i 's|/var/www|$httpROOTDIR|' $httpCONFDIR/conf.d/php_mysql_test.conf" - rlRun "chown -R apache: $httpROOTDIR/php_mysql_test" - #rlRun "restorecon $httpROOTDIR/php_mysql_test" - selinuxenabled && rlRun "chcon -Rv -t httpd_sys_content_t $httpROOTDIR/php_mysql_test" - rlRun "httpStart" 0 "Start httpd" - rlPhaseEnd - - rlPhaseStartTest - URL="http://localhost/php_mysql_test/" - RETVAL=0 - tries=`seq 1 10` - - for n in ${tries}; do - output=`curl -s $URL/mysql.php` - rv=$? - echo "PHP output ${n}: ${rv} x${output}y" - [ ${rv} -ne 0 -o "x${output}y" != "xfish is 42y" ] && RETVAL=66 - done - - if [ $RETVAL -ne 0 ]; then - rlFail - else - rlPass - fi - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "rm -f $httpCONFDIR/conf.d/php_mysql_test.conf" - rlRun "rm -rf $httpROOTDIR/php_mysql_test" - rlRun "echo DROP DATABASE php_mysql_test | mysql -u root" - rlRun "rlServiceRestore ${SERVICE}" 0 - rlRun "httpStop" 0 "Stop httpd if running" - # uninstall php-mysql on rhel-6 if it was installed during setup - phpPdoPhpMysqlCleanup - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/tests.yml b/tests/ignore_tests.yml similarity index 88% rename from tests/tests.yml rename to tests/ignore_tests.yml index e0ef0be..802bea0 100644 --- a/tests/tests.yml +++ b/tests/ignore_tests.yml @@ -6,7 +6,7 @@ tags: - classic tests: - - httpd-php-mysql-sanity-test + - smoke required_packages: - findutils # beakerlib needs find command - which # smoke requires which command diff --git a/tests/httpd-php-mysql-sanity-test/Makefile b/tests/smoke/Makefile similarity index 65% rename from tests/httpd-php-mysql-sanity-test/Makefile rename to tests/smoke/Makefile index a688236..6abde94 100644 --- a/tests/httpd-php-mysql-sanity-test/Makefile +++ b/tests/smoke/Makefile @@ -1,12 +1,12 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Makefile of /CoreOS/httpd/Sanity/httpd-php-mysql-sanity-test -# Description: test fetching data from mysqldb/mariadb through php -# Author: Karel Srot +# Makefile of /CoreOS/httpd/Sanity/smoke +# Description: Simple check of httpd test page +# Author: Branislav Nater # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# Copyright (c) 2021 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing # to use, modify, copy, or redistribute it subject to the terms @@ -24,12 +24,12 @@ # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export TEST=/CoreOS/httpd/Sanity/httpd-php-mysql-sanity-test +export TEST=/CoreOS/httpd/Sanity/smoke export TESTVERSION=1.0 BUILT_FILES= -FILES=$(METADATA) runtest.sh Makefile PURPOSE new_mysql.php old_mysql.php php_mysql_test.sql php_mysql_test.conf +FILES=$(METADATA) runtest.sh Makefile PURPOSE .PHONY: all install download clean @@ -43,25 +43,23 @@ clean: rm -f *~ $(BUILT_FILES) --include /usr/share/rhts/lib/rhts-make.include +include /usr/share/rhts/lib/rhts-make.include $(METADATA): Makefile - @echo "Owner: Karel Srot " > $(METADATA) + @echo "Owner: Branislav Nater " > $(METADATA) @echo "Name: $(TEST)" >> $(METADATA) @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: test fetching data from mysqldb/mariadb through php" >> $(METADATA) + @echo "Description: Simple check of httpd test page" >> $(METADATA) @echo "Type: Sanity" >> $(METADATA) @echo "TestTime: 5m" >> $(METADATA) @echo "RunFor: httpd" >> $(METADATA) - @echo "Requires: httpd php php-zts php-mysqlnd mysql-server mariadb-server" >> $(METADATA) + @echo "Requires: httpd mod_ssl" >> $(METADATA) @echo "RhtsRequires: library(httpd/http)" >> $(METADATA) - @echo "RhtsRequires: library(mysql/basic)" >> $(METADATA) - @echo "RhtsRequires: library(mariadb55/basic)" >> $(METADATA) - @echo "RhtsRequires: library(php/utils)" >> $(METADATA) @echo "Priority: Normal" >> $(METADATA) @echo "License: GPLv2" >> $(METADATA) @echo "Confidential: no" >> $(METADATA) @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) rhts-lint $(METADATA) diff --git a/tests/smoke/PURPOSE b/tests/smoke/PURPOSE new file mode 100644 index 0000000..510e749 --- /dev/null +++ b/tests/smoke/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/httpd/Sanity/smoke +Description: Simple check of httpd +Author: Branislav Nater diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh new file mode 100755 index 0000000..f65c8ba --- /dev/null +++ b/tests/smoke/runtest.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/httpd/Sanity/smoke +# Description: Simple check of httpd test page +# Author: Branislav Nater +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 Red Hat, Inc. +# +# 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 rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGES="${PACKAGES:-httpd}" +REQUIRES=${REQUIRES:-} + +rlJournalStart + rlPhaseStartSetup + rlRun "rlImport --all" 0 "Importing Beaker libraries" || rlDie + rlAssertRpm --all + rlFileBackup --clean ${httpCONFDIR}/conf/ + rlFileBackup --clean ${httpCONFDIR}/conf.d/ + rlFileBackup --clean ${httpCONFDIR}/conf.modules.d/ + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "httpStart" 0 "Start httpd" + rlRun "httpStatus" 0 "Check status" + rlRun "httpStop" 0 "Stop httpd" + + rlRun "httpSecureStart" 0 "Start httpd with ssl" + rlRun "httpInstallCa $(hostname)" 0 "Install CA" + rlRun "httpSecureStatus" 0 "Check status" + rlRun "httpRemoveCa" 0 "Remove CA" + rlRun "httpSecureStop" 0 "Stop httpd with ssl" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rlFileRestore" 0 "Restoring original configuration" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalEnd +rlJournalPrintText