diff --git a/.gitignore b/.gitignore index 8170d38..02bfa24 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ +/bottle-0.9.5.tar.gz +/bottle-0.10.7.tar.gz +/bottle-0.11.6.tar.gz +/bottle-0.11.7.tar.gz +/bottle-0.12.6.tar.gz +/bottle-0.12.9.tar.gz /bottle-0.12.13.tar.gz diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..6985029 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/build-pycurl/runtest.sh b/tests/build-pycurl/runtest.sh new file mode 100755 index 0000000..8009f98 --- /dev/null +++ b/tests/build-pycurl/runtest.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# exit immediately if any command returns non-zero exit code +set -e + +# print commands as they are executed by the shell interpreter +set -x + +# download source RPM of python-pycurl +yum download --source python-pycurl + +# rebuild the source RPM (%check uses bottle) +rpmbuild --rebuild ./python-pycurl-*.src.rpm diff --git a/tests/simple-server/hello.py b/tests/simple-server/hello.py new file mode 100755 index 0000000..89ea73b --- /dev/null +++ b/tests/simple-server/hello.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +from bottle import route, run, template + +@route('/hello/') +def index(name): + return template('Hello {{name}}!', name=name) + +run(host='localhost', port=1234) diff --git a/tests/simple-server/runtest.sh b/tests/simple-server/runtest.sh new file mode 100755 index 0000000..f4a88b8 --- /dev/null +++ b/tests/simple-server/runtest.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# exit immediately if any command returns non-zero exit code +set -e + +# print commands as they are executed by the shell interpreter +set -x + +# global constants +HOST="localhost" +PORT="1234" +URL="http://${HOST}:${PORT}/hello/rhel" +CURL_OUT="./curl.out" +CURL_ERR="./curl.err" + +# print versions of related pkgs +PKGS="$(set +x; eval echo {lib,}curl python3-bottle)" +rpm -q $PKGS | sort -V +rpm -V $PKGS + +# run HTTP server in the background +./hello.py & +BOTTLE_PID=$! + +# FIXME: wait for open port instead +sleep 2 + +# check that HTTP server works using curl +curl -fsvo $CURL_OUT $URL + +# check whether the received data matches the expected contents +diff <(printf "Hello rhel!") $CURL_OUT + +# kill nghttpd running in the background +kill $BOTTLE_PID + +# wait till the background process finishes +wait diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..79e50a0 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,24 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - simple-server: + dir: simple-server + run: ./runtest.sh + - build-pycurl: + dir: build-pycurl + run: ./runtest.sh + required_packages: + - curl + - dnf + - gcc + - libcurl-devel + - make + - openssl-devel + - python3-devel + - python3-bottle + - python3-nose + - rpm-build + - vsftpd