Use tmt+osci for gating
Add smoke test based on the quick start from documentation
This commit is contained in:
parent
a9322e7bb0
commit
959d07e650
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
||||
@ -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
12
tests/plan.fmf
Normal 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
10
tests/quick_start.fmf
Normal 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
20
tests/quick_start.py
Normal 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'
|
||||
Loading…
Reference in New Issue
Block a user