DO NOT MERGE the spec change

Adding test for inplace upgrade of running python
https://bugzilla.redhat.com/show_bug.cgi?id=233385
This commit is contained in:
Lukáš Zachar 2025-05-15 18:09:20 +02:00
commit 59c48c8247
6 changed files with 66 additions and 1 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

12
plans/runtime.fmf Normal file
View file

@ -0,0 +1,12 @@
execute:
how: tmt
discover:
how: fmf
test: /runtime
path: ./tests
prepare:
- name: install
how: install
exclude: '*'

View file

@ -17,7 +17,7 @@ URL: https://www.python.org/
#global prerel ...
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 3%{?dist}
Release: 3%{?dist}_test
License: Python-2.0.1

2
tests/runtime/main.fmf Normal file
View file

@ -0,0 +1,2 @@
test: ./test.sh
framework: beakerlib

19
tests/runtime/repro.py Normal file
View file

@ -0,0 +1,19 @@
import time
from pathlib import Path
flag_file = Path('/tmp/runtime')
status_file = Path('/tmp/runtime_status')
assert not flag_file.exists()
print(f'Started - touch {flag_file} when ready')
print(f'Status in {status_file}')
status_file.write_text('running')
while not flag_file.exists():
time.sleep(2)
import email.parser
print('DONE')
status_file.write_text('PASS')

31
tests/runtime/test.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
STATUS_FILE=/tmp/runtime_status
FLAG_FILE=/tmp/runtime
cleanup(){
for f in $STATUS_FILE $FLAG_FILE; do
test -e $f && rm -f $f
done
}
rlJournalStart
rlPhaseStartTest
cleanup
rlRun "rpm -q python3 && python3 --version"
python3 repro.py &
rlWaitForFile $STATUS_FILE
rlRun "dnf update -y python*"
rlRun "rpm -q python3 && python3 --version"
rlRun "touch $FLAG_FILE"
sleep 2
rlAssertGrep 'PASS' $STATUS_FILE
rlPhaseEnd
rlPhaseStartCleanup
cleanup
rlPhaseEnd
rlJournalEnd