Skip to content

Commit

Permalink
Fix a bad granular gabbi test
Browse files Browse the repository at this point in the history
A gabbi test for multiple member_of<N> was using the `query_parameters`
keyword to construct the querystring; but it was trying to test what
happens when member_of<N> is specified multiple times. In this test, N
was the same for both, but the query parameters were being entered as
separate dict keys; so the querystring was only being constructed with
the latter value, because yaml [1]. The test was passing spuriously
because it happens to be the case that the result would be the same if
only the latter value is specified. (If you reversed the order of the
two member_ofZ, the test failed.)

This change re-YAMLs the query_parameters to use list syntax for the
values of the member_of key, from which gabbi will dtrt in constructing
the querystring.

NB: It might be nice to find a test scenario where the false positive
wouldn't have been possible; but that would be a bigger effort that
could possibly entail reswizzling the GranularFixture and therefore the
whole gabbit. Done this way, we're at least sure that both values are
making it to the handler; and switching the order in the querystring has
no effect (though the order is apparently not guaranteed/deterministic
anyway [2]).

[1] yaml/pyyaml#165
[2] https://gabbi.readthedocs.io/en/latest/example.html (search for
query_parameters)

Change-Id: I10f28d8c21643be69b67f25dcc043cd9640eac42
  • Loading branch information
Eric Fried committed Feb 25, 2019
1 parent 8723768 commit a3c3370
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions placement/tests/functional/gabbits/granular.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ tests:
query_parameters:
resources1: VCPU:1
resources2: DISK_GB:100
member_of2: $ENVIRON['AGGA']
member_of2: in:$ENVIRON['AGGB'],$ENVIRON['AGGC']
member_of2:
- in:$ENVIRON['AGGB'],$ENVIRON['AGGC']
- $ENVIRON['AGGA']
group_policy: isolate
status: 200
response_json_paths:
Expand Down

0 comments on commit a3c3370

Please sign in to comment.