[openstack-dev] [all] [api] gabbi: A tool for declarative testing of APIs
chdent at redhat.com
Tue Mar 3 11:25:53 UTC 2015
On Tue, 3 Mar 2015, Steve Baker wrote:
> This looks very useful, I'd like to use this in the heat functional tests
Awesome, let me know if you need any assistance getting started.
> Is it possible to write tests which do a POST/PUT then a loop of GETs until
> some condition is met (a response_json_paths match on IN_PROGRESS ->
Not yet, but it is something that has been lurking in the back of my
mind. Under the covers the implementation wouldn't be too hard but
I've held off because getting the syntax right seem tricky. It should
be clear but not too invasive and because of the way the test suites
are managed the info would need to be expressed in the chunk of
YAML that represents just one request.
One option would be to allow a test to sleepy loop and fail N times
(or a duration of N seconds) until allowing the failure exception to
rise out of the loop. In this case the COMPLETE info would be the
success condition and IN_PROGRESS wouldn't be noted at all.
Another option would be to express the try again condition
(IN_PROGRESS) and the done condition (COMPLETE) with new syntax and
loop on try again, finish on done and fail otherwise.
I think I prefer the first because it is more general and requires
less syntax but it may be insufficiently expressive.
What I want to be sure to avoid is clouding up the syntax with a bunch
of meta hooey that obscures the basic request and response chunks. So,
for example, if it became clear we needed some way to express a sleep
then that sleep would be just one key and we'd (somehow) avoid going
down the messy road of expressing two differents kinds of sleep: one
at top of and one at the bottom of the loop.
What might be best is for you or us to write some tests that express
what you want to express and then see how best to implement that. This
is how the new $ENVIRON template feature got added.
Chris Dent tw:@anticdent freenode:cdent
More information about the OpenStack-dev