Brock Pytlik wrote:
Shawn Walker wrote:
On 02/11/10 01:22 PM, Brock Pytlik wrote:
Shawn Walker wrote:
The following webrev contains fixes for the following issue (3 lines,
but webrev posted for clarity):
14515 client can traceback during search
webrev:
http://cr.opensolaris.org/~swalker/pkg-14515/
I'd like to add a unit test for this, but can't think of a good way to
do so since it is a timing-related failure.
Cheers,
LGTM
How's it timing related?
From what I see in the code, the assert would only fail if res is
empty or undefined, and that would only happen if page_again is True?
If you could help explain the "res or consec_dup_lines" that would
help me formulate a test case since all the current tests pass already.
Well, last_res is the last line of the previous page, if any exist.
remove_consec_dup_lines is the boolean that determines whether
consecutive duplicate lines are removed or not.
The only way to make this happen by calling pkg search in the test
suite would be to have enough return values (or a slow enough server)
that it starts paging the output. That's hard to accomplish in the
test suite. Not impossible, though. My suggestion for a test is to
make it an api test and simply call produce_lines with the values set
in an appropriate way to cause the assert to fail.
A third option would be to extract the constants from search and make
them global variables, then twiddle the page_timeout from the test
suite to set it to 0, so that you page frequently.
Brock
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
Fourth option, switch the order of the conditional in the assert around.
pkg contents always calls produce lines with remove_consec_dup_lines set
to False, search always calls it with it set to true. Between the two,
you can be assured that last_res will at least be evaluated.
Brock
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss