Bug 12782: (followup) skip tests that fail because of provider's error
It seems that XISBN is failing sometimes, if you run the tests a couple of times in a row. An error 500 is raised by lwp. This problem should be trapped and related tests skipped. Because too much noise could make people pay no attention to this tests failing. To reproduce: - Run the tests several consecutive times: $ prove -v t/db_dependent/XISBN.t => FAIL: XISBN test will fail eventually, printing a networking-related warning. - Apply the patch - Repeat the test => SUCCESS: when XISBN the networking/connection refused problem arises, the test is skipped, and it still passes. Regards To+ Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Mason James <mtj@kohaaloha.com>
This commit is contained in:
parent
d60c07e85c
commit
78c841a164
|
|
@ -53,19 +53,33 @@ $trial = C4::XISBN::_get_biblio_from_xisbn($isbn1);
|
|||
is( $trial->{biblionumber},
|
||||
$biblionumber1, "Gets biblionumber like the previous test." );
|
||||
|
||||
## Test ThingISBN
|
||||
$context->set_preference( 'ThingISBN', 1 );
|
||||
$context->set_preference( 'XISBN', 0 );
|
||||
my $results_thingisbn = C4::XISBN::get_xisbns($isbn1);
|
||||
is( $results_thingisbn->[0]->{biblionumber},
|
||||
$biblionumber3,
|
||||
"Gets correct biblionumber from a book with a similar isbn using ThingISBN." );
|
||||
|
||||
my $results_thingisbn;
|
||||
eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1); };
|
||||
SKIP: {
|
||||
skip "Problem retrieving ThingISBN", 1
|
||||
unless $@ eq '';
|
||||
is( $results_thingisbn->[0]->{biblionumber},
|
||||
$biblionumber3,
|
||||
"Gets correct biblionumber from a book with a similar isbn using ThingISBN." );
|
||||
}
|
||||
|
||||
## Test XISBN
|
||||
$context->set_preference( 'ThingISBN', 0 );
|
||||
$context->set_preference( 'XISBN', 1 );
|
||||
my $results_xisbn = C4::XISBN::get_xisbns($isbn1);
|
||||
is( $results_xisbn->[0]->{biblionumber},
|
||||
$biblionumber3,
|
||||
"Gets correct biblionumber from a book with a similar isbn using XISBN." );
|
||||
|
||||
my $results_xisbn;
|
||||
eval { $results_xisbn = C4::XISBN::get_xisbns($isbn1); };
|
||||
SKIP: {
|
||||
skip "Problem retrieving XISBN", 1
|
||||
unless $@ eq '';
|
||||
is( $results_xisbn->[0]->{biblionumber},
|
||||
$biblionumber3,
|
||||
"Gets correct biblionumber from a book with a similar isbn using XISBN." );
|
||||
}
|
||||
|
||||
$dbh->rollback;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue