Use tmt+osci for gating

Add smoke test based on the quick start from documentation
This commit is contained in:
Lukáš Zachar 2026-06-29 16:43:56 +02:00
parent a9322e7bb0
commit 959d07e650
5 changed files with 45 additions and 1 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -3,4 +3,5 @@ product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

12
tests/plan.fmf Normal file
View File

@ -0,0 +1,12 @@
environment:
PYTHON: /usr/libexec/platform-python
discover:
how: fmf
execute:
how: tmt
prepare:
how: feature
crb: enabled

10
tests/quick_start.fmf Normal file
View File

@ -0,0 +1,10 @@
test: |
trap cleanup EXIT
cleanup(){
test -d indexdir && rm -rf indexdir
}
mkdir indexdir
${PYTHON:-python3} quick_start.py
require:
- python3-whoosh

20
tests/quick_start.py Normal file
View File

@ -0,0 +1,20 @@
# Based on
# https://whoosh.readthedocs.io/en/latest/quickstart.html#a-quick-introduction
from whoosh.index import create_in
from whoosh.fields import *
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
ix = create_in("indexdir", schema)
writer = ix.writer()
writer.add_document(title=u"First document", path=u"/a",
content=u"This is the first document we've added!")
writer.add_document(title=u"Second document", path=u"/b",
content=u"The second one is even more interesting!")
writer.commit()
from whoosh.qparser import QueryParser
with ix.searcher() as searcher:
query = QueryParser("content", ix.schema).parse("first")
results = searcher.search(query)
result = results[0]
assert result.get('title') == 'First document'