Skip to content

Commit

Permalink
Fix exception check in RecoveryRequestTrackerTests (#57493)
Browse files Browse the repository at this point in the history
Currently we check that exceptions are the same in the recovery request
tracker test. This is inconsistent because the future wraps the
exception in a new instance. This commit fixes the test by comparing a
random exception message.

Fixes #57199
  • Loading branch information
Tim-Brooks authored Jun 2, 2020
1 parent 6a769ea commit 2b6853f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.elasticsearch.indices.recovery;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
Expand Down Expand Up @@ -47,7 +48,6 @@ public void tearDown() throws Exception {
super.tearDown();
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/57199")
public void testIdempotencyIsEnforced() {
Set<Long> seqNosReturned = ConcurrentCollections.newConcurrentSet();
ConcurrentMap<Long, Set<PlainActionFuture<Void>>> seqToResult = ConcurrentCollections.newConcurrentMap();
Expand All @@ -69,7 +69,7 @@ public void testIdempotencyIsEnforced() {
// Ensure that we only return 1 future per sequence number
assertTrue(added);
if (rarely()) {
listener.onFailure(new Exception());
listener.onFailure(new ElasticsearchException(randomAlphaOfLength(10)));
} else {
listener.onResponse(null);
}
Expand Down Expand Up @@ -104,7 +104,7 @@ public void testIdempotencyIsEnforced() {
future.actionGet();
fail("expected exception");
} catch (Exception e) {
assertSame(e, expectedException);
assertEquals(expectedException.getMessage(), e.getMessage());
}
}
}
Expand Down

0 comments on commit 2b6853f

Please sign in to comment.