From 143d49997e2349ea1b4889b56938eac44c8c28e5 Mon Sep 17 00:00:00 2001 From: Scott Poore Date: Thu, 15 Aug 2024 14:50:47 -0500 Subject: [PATCH] add c10s gating tests and tmt configs --- .fmf/version | 1 + gating.yaml | 6 +++++ plans/all.fmf | 8 ++++++ tests/main.fmf | 6 +++++ tests/oauthtests.sh | 48 ++++++++++++++++++++++++++++++++++++ tests/requirements-tests.txt | 6 +++++ tests/tests.yml | 17 +++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/all.fmf create mode 100644 tests/main.fmf create mode 100755 tests/oauthtests.sh create mode 100644 tests/requirements-tests.txt create mode 100644 tests/tests.yml 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/gating.yaml b/gating.yaml new file mode 100644 index 0000000..4ca9235 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plans/all.fmf b/plans/all.fmf new file mode 100644 index 0000000..d538d2d --- /dev/null +++ b/plans/all.fmf @@ -0,0 +1,8 @@ +summary: Run gating tests +discover: + how: fmf + dist-git-source: true + dist-git-type: centos + +execute: + how: tmt diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..f14ac5c --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,6 @@ +summary: Run python-oauthlib upstream tests +require: + - httpd + - python-requests-oauthlib +test: ./oauthtests.sh +duration: 30m diff --git a/tests/oauthtests.sh b/tests/oauthtests.sh new file mode 100755 index 0000000..5af9ddb --- /dev/null +++ b/tests/oauthtests.sh @@ -0,0 +1,48 @@ +#!/bin/bash -x + +PKG="python-requests-oauthlib" + +die () { + echo "$1" >&2 + exit 1 +} + +# +# install dependencies (pytest & blinker) +# +rm -rf venv +python3 -m venv --system-site-packages --symlinks venv +. venv/bin/activate +pip install -r requirements-tests.txt + +PKG="python-requests-oauthlib" +# If source not found, download it with dnf +if [ ! -d ./source ]; then + # Extract source from srpm + echo "## source directory not found. attempting to download via rpm" + dnf download --source ${PKG} && \ + rpm2cpio ${PKG}*.rpm|cpio -id && \ + mkdir source && \ + TARBALL="v$(rpm -q --qf="%{version}" -p ${PKG}*.rpm).tar.gz" + tar -zxf ${TARBALL} -C source --strip-components=1 + if [ $? != 0 ]; then + echo "Failed to download upstream tests" + exit 1 + fi +fi + +# rename source code directory to be sure that we are +# testing files from our rpm +cd source || die "Missing source directory!" + +# +# run upstream tests, skip jwt tests +# +pytest -p no:warnings -k "not testCanPostBinaryData and not test_content_type_override and not test_url_is_native_str"| tee oauthlib.log +RESULT=${PIPESTATUS[0]} + +# +# cleanup +# + +exit $RESULT diff --git a/tests/requirements-tests.txt b/tests/requirements-tests.txt new file mode 100644 index 0000000..4ed06f8 --- /dev/null +++ b/tests/requirements-tests.txt @@ -0,0 +1,6 @@ +pytest==7.2 +requests==2.26.0 +oauthlib[signedtoken]==3.1.1 +coveralls==3.2.0 +mock==4.0.3 +requests-mock==1.9.3 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..ed66ff3 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,17 @@ +--- +- hosts: localhost + roles: + - role: standard-test-source + tags: + - always + + - role: standard-test-basic + tags: + - classic + required_packages: + - python3-requests-oauthlib + tests: + - requests-oauthlib: + dir: . + run: ./oauthtests.sh + save-files: ["source/*.log"]