From db207444c9844fcb22b827c887faee56fcb01bc7 Mon Sep 17 00:00:00 2001 From: Lukas Zachar Date: Fri, 3 Feb 2023 11:02:58 +0100 Subject: [PATCH] Add tmt gating plan Resolves: rhbz#2159305 --- .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..a77f895 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy + +product_versions: + - rhel-9 +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..0cad970 --- /dev/null +++ b/plan.fmf @@ -0,0 +1,8 @@ +execute: + how: tmt +discover: + - how: shell + tests: + - name: simple import + test: python3.11 -c 'import pymysql' + - how: fmf diff --git a/tests/smoke_test.fmf b/tests/smoke_test.fmf new file mode 100644 index 0000000..a7a06e6 --- /dev/null +++ b/tests/smoke_test.fmf @@ -0,0 +1,8 @@ +require: +- mariadb-server +- python3.11-PyMySQL + +test: | + systemctl start mariadb && + python3.11 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()