From ecb6d9494412fd4f89d50cd29cde4bc955dcd5ff Mon Sep 17 00:00:00 2001 From: Scott Poore Date: Wed, 3 Jul 2024 15:57:02 -0500 Subject: [PATCH] Update gating tests to be tmt compatible --- .fmf/version | 1 + plans/all.fmf | 8 ++++++++ tests/main.fmf | 6 ++++++ tests/oauthtests.sh | 19 +++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/all.fmf create mode 100644 tests/main.fmf 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/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..2d042c3 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1,6 @@ +summary: Run python-oauthlib upstream tests +require: + - httpd + - python-oauthlib +test: ./oauthtests.sh +duration: 30m diff --git a/tests/oauthtests.sh b/tests/oauthtests.sh index cbe06d0..e0cd5f0 100755 --- a/tests/oauthtests.sh +++ b/tests/oauthtests.sh @@ -1,5 +1,7 @@ #!/bin/bash -x +PKG="python-oauthlib" + die () { echo "$1" >&2 exit 1 @@ -14,10 +16,23 @@ fi # install dependencies (pytest & blinker) # rm -rf venv -python3 -m venv venv +python3 -m venv --system-site-packages --symlinks venv . venv/bin/activate pip install -r requirements-tests.txt +# 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 && \ + tar -zxf ${PKG}-*.tar.gz -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 @@ -25,7 +40,7 @@ cd source || die "Missing source directory!" if [ -d oauthlib ] ; then mv oauthlib oauthlib.backup || die "Can't rename/hide source code directory!" fi -ln -s $SITEDIR/oauthlib || die "Can't locate installed library" +# ln -s $SITEDIR/oauthlib || die "Can't locate installed library" # # run upstream tests, skip jwt tests