From be493ddc2ec813d061133acbb6c666e210dcbb5e Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Thu, 11 Jan 2024 13:12:42 +0100 Subject: [PATCH] Add tmt gating plan Cherry-picked from python3.11-PyMySQL db207444c9844fcb22b827c887faee56fcb01bc7 https://gitlab.com/redhat/centos-stream/rpms/python3.11-PyMySQL/-/commit/db207444c9844fcb22b827c887faee56fcb01bc7 --- .fmf/version | 1 + gating.yaml | 7 +++++++ plan.fmf | 8 ++++++++ tests/smoke_test.fmf | 8 ++++++++ tests/smoke_test.py | 12 ++++++++++++ 5 files changed, 36 insertions(+) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plan.fmf create mode 100644 tests/smoke_test.fmf create mode 100644 tests/smoke_test.py 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..0c0cbb2 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy + +product_versions: + - rhel-8 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..e2c8112 --- /dev/null +++ b/plan.fmf @@ -0,0 +1,8 @@ +execute: + how: tmt +discover: + - how: shell + tests: + - name: simple import + test: python3.12 -c 'import pymysql' + - how: fmf diff --git a/tests/smoke_test.fmf b/tests/smoke_test.fmf new file mode 100644 index 0000000..70e9ef0 --- /dev/null +++ b/tests/smoke_test.fmf @@ -0,0 +1,8 @@ +require: +- mariadb-server +- python3.12-PyMySQL + +test: | + systemctl start mariadb && + python3.12 smoke_test.py && + systemctl stop mariadb diff --git a/tests/smoke_test.py b/tests/smoke_test.py new file mode 100644 index 0000000..55fcfff --- /dev/null +++ b/tests/smoke_test.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 +# Modified from +# https://github.com/PyMySQL/PyMySQL/blob/v1.0.2/example.py + +import pymysql +connection = pymysql.connect(unix_socket="/var/lib/mysql/mysql.sock", db="mysql") +cursor = connection.cursor() +cursor.execute("SELECT Host,User FROM user") +print(cursor.description) + +cursor.close() +connection.close()