#382 Basic&beakerlib take into account external termination.
Merged by astepano. Opened by astepano.
ext_term  into  master

Download 382.patch

@bgoncalv
The pipeline has code:

timeout 4h ansible-playbook -v --inventory=pipeline_inventory.yaml --extra-vars ansible_python_interpreter=/usr/bin/python3 --tags classic tests.yml

I would like to ask you to test this PR for this case with command:

timeout 3min ansible-playbook tests.yml

both for basic + beakerlib roles

Make sure that the the running test is reported as ERROR.
Current STR without this PR should mark running test as PASS.

Thank you.

pretty please pagure-ci rebuild

@astepano I've tried with standard-test-roles-4.4-1.fc31.602680d.1.noarch the tests now don't have the PASS prefix, but they don't have ERROR either, they don't contain any prefix.

# ls /tmp/artifacts/
str_test-abort-playbook-basic.log  test-abort-playbook-beakerlib-err.log  test-abort-playbook-beakerlib.log

timeout 2m ansible-playbook --inventory=pipeline_inventory.yaml --extra-vars ansible_python_interpreter=/usr/bin/python3 --tags classic timeout_basic.yml

basic playbook:

# Make sure the role report error when playbook aborts
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
    tests:
    - test-abort-playbook-basic:
        run: sleep 240

timeout 2m ansible-playbook --inventory=pipeline_inventory.yaml --extra-vars ansible_python_interpreter=/usr/bin/python3 --tags classic timeout_beakerlib.yml

beakerlib playbook

# Make sure the role report error when playbook aborts
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-beakerlib
    tests:
    - test-abort-playbook-beakerlib:
        run: sleep 240

test-abort-playbook-beakerlib/runtest.sh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/bash
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="bash"
rlJournalStart
    rlPhaseStartTest "test abort playbook with beakerlib role"
        rlRun "sleep 240"
    rlPhaseEnd
rlJournalPrintText
rlJournalEnd

rebased onto 1391eea1334328bbc585baa8bd83577304a1b82d

Updated. @bgoncalv
It was hard. I do not know how it worked before.
Please test again for basic&beakerlib in different ways.
Thank you.

rebased onto d1b05453fe576be7faff579f0e6c32fd818a3736

rebased onto 0412f64ac6ad030d5a068f1176ecadcbdd77d41f

@astepano thanks a lot for this work! I've tested with standard-test-roles-4.4-1.fc31.0412f64.1.noarch and basic and beakerlib roles were aborted succesfully, the tests got ERROR prefix and results.yml was correctly created!

Just a note with official STR standard-test-roles-4.5-3.fc31.noarch beakerlib role was already reporting aborted test with ERROR prefix correctly, so basically it would be your decision if you want use this fix for bekerlib role or not.

Why this line needs to be removed?

That string comes not from test itself.
That string comes from cleaner.
That log supposed to have output from test.
I would like to keep that string, but:

with this PR that string doesn't go to that file.
in that place (in cleaner) no reliable way to to print any data to log at at that moment.
because it happens during cleanup, and tee process can be terminated at that point.

Could you please check current (without PR) test for beakerlib.
Without timeout:
ansible-playbook ....
And press CTRL-C, will it have ERROR too? If yes, then I will remove changes to beakerlib.
Thank you.

CTRL-C at during task-run Run beakerlib tests

CTRL-C at during task-run Run beakerlib tests

Cool, the CTRL-C only works with the patch.

Commit 5589c7b3 fixes this pull-request

Pull-Request has been merged by astepano

Pull-Request has been merged by astepano

Metadata