-
Notifications
You must be signed in to change notification settings - Fork 6k
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
behave_tests: Implemented basic behave test scenario's for cephadm, ceph shell and OSD commands #41918
Conversation
ef9a1f4
to
e91b8e8
Compare
Great beginning! First thing to improve: We need a Tox environment. Tox allow us to use virtual environments to install dependencies and execute our python scripts without need to install these dependencies in any host that execute our scripts. We can start with a basic tox.ini file placed in the like:
After that you can execute our behave test just typing:
and you can reiew your python style problems with:
Note: Obviously, tox must be installed in your laptop |
ee5a784
to
009ce26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the small problem rendering the disk section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the test based on the behave framework falls into the category of "test", i'd suggest move it to src/test
.
This comment has been minimized.
This comment has been minimized.
1914f1f
to
36aa1a7
Compare
@SudhanAruna i am not qualified to review this change. i'd defer this to cephadm experts like @jmolmo and @sebastian-philipp . |
Very good progress!!! This starts to seem something really awesome. Good job Arun!! Apart of the minor suggestions i did..is time to start with a next kind of feature: very similar to what we have in the current feature, but now the commands and the result comes from "cephadm shell" |
5e872a2
to
5933d0c
Compare
bd15bd0
to
1529fe1
Compare
print(f"Executed output : {context.output}") | ||
|
||
|
||
@then("I wait for {wait_time:n} seconds until I get") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to improve this part.. because waiting for nothing is not the right thing to do :-)
What we really need is to execute something and if the expected output is not the desired, wait a little bit, and execute again the command to see if the things have changed.
When can add the decorator in all the functions that must obtain a result a the result maybe is not going to be immediate, the definition of this step could be very similar to the one proposed by you_
@then("I will continue trying to get and compare the result every {wait_time:n} seconds with a timeout of {timeout_time:n} seconds ")
I suggest to create a function to work as decorator. This function will receive as parameter the function that implements the step and returns true if the function success , and false if the parameter function has failed 8 or the timeout expires.
We will need also to change functions to implement each step to return a boolean.
Ex:
@execute_with_timeout(60,5)
def execute_step(context):
...
return expected_output == executed_output)
def execute_with_timeout(f, timeout, wait)
time_waiting =0
while timeout > time_waiting:
result = f()
if result:
return result
else:
time.sleep(wait)
time_waiting += wait
print("Timeout reached waiting for expected output")
return result
7bc2db3
to
63ec5a3
Compare
@SudhanAruna Can you please update the PR description on how to test this? |
@alfonsomthd |
@SudhanAruna The README is OK but you should add in the PR description (as well as in the commit body): |
63ec5a3
to
9c7c894
Compare
9c7c894
to
94dea3b
Compare
@alfonsomthd I have updated the PR as requested but I couldn't find the ceph tacker issue for this project. |
b943bf7
to
7591ed2
Compare
jenkins retest this please |
Fixes: https://tracker.ceph.com/issues/52371 This commit includes the basic implementation of behave test scenario's (for cephadm, ceph shell and OSD commands) and python implementations for interacting with kcli and behave test cases. The test scenarios can be executed using behave command. The files are created under src/test/behave_tests directory. Signed-off-by: Arunagirinadan Sudharshan <sudhan.aruna.97@gmail.com>
7591ed2
to
2071dfd
Compare
This commit includes the basic implementation of behave test scenario's ( for cephadm, ceph shell and OSD commands) and
python implementations for interacting with kcli and behave test cases. The test scenarios can be execute all together or only the
specific scenarios with tags.
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox