-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFE] Reduce amount of boilerplate code needed by the beakerlib library #142
Comments
First, beakerlib is just a library. I'm not saying no but the original ambition was not the framework. We would need wider consensus on this. What do you say @hegerj ? In case of more difficult tests with more setup and cleanup phases or phases generate in a loop it would be much more complicated and I can imagine the users of this approach would be asking for that sooner or later. |
This seems like a quite a tall order and I am not quite sure what is the primary use case for this. Is your biggest problem that if test fails in Setup phase it is pointless to run Test phase @i386x? |
I see. I can make this a standalone script then and request a repo for it either in beakerlib namespace so QEs can contribute to it or in pagure.io.
mcase combined with Cleanup is closest to what I am aiming for. The test runner can be build on top of them.
@hegerj My primary use case is to have some level of comfort both for devel when writing tests and for QE when reading logs. Let me demonstrate on Again, my aim is not to change |
Story
As a test writer using
beakerlib
I want just to focus on tests. I want a tool that will generatebeakerlib
's boilerplate code for me.Detail
Actually tests in
beakerlib
have the following structure (generated bytmt
orbeakerlib-wizard
):When implemented, this proposal (described after the following snippet) allows user to reduce the test above to:
Now lets describe what will be needed to done on the
beakerlib
and eventually on thetmt
side to make this happen. Suppose users have their tests prepared inruntest.sh
file alongside withmain.fmf
1 file containing the necessary metadata.beakerlib
about a stack-like storage where cleanup actions can be registered and functions that manipulate with it. Additionally implementrlMakeTmpDir
which makes a temporary directory and pushes code that removes it on the cleanup stack;rlPushTmpDir
whichpushd
to the temporary directory and pushespopd
on the cleanup stack.beakerlib
, add a new executable script (call itrlrun
for now), that roughly performs following steps (details can be discussed further):runtest.sh
./usr/share/beakerlib/beakerlib.sh
PACKAGES
,REQUIRES
and possiblyrlImport
s frommain.fmf
.test_
#: text
which precedes the test it describes./runtest.sh
.rlAssertRpm --all
beakerlib
library to berlImport
ed, runrlImport
Setup
function is defined, run itBackground
As a
beakerlib
user, I was quite unsatisfied with currentbeakerlib
behavior. In a scenario when some part of setup phase fails, like a certificate is not generated, dependent tests also automatically fail, making unnecessary noise in the test log.A discussion with @AloisMahdal and his idea to wrap tests written in
beakerlib
to functions to allow exit from tests whenever there is no reason to continue in execution inspired me to create a simple shell library I am using in my still-in-progress burning stack test suite. The library is usingif setup the run_tests; cleanup
pattern used by many test execution frameworks. It reduces abeakerlib
's boilerplate a bit but there's still a room for improvement. This proposal is the next evolution step of the library.In case of interest or if someone will find this useful I will implement it and open a PR.
Footnotes
In this case, the content of
↩main.fmf
may looks like:The text was updated successfully, but these errors were encountered: