You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2020/04/02 21:10:01 UTC
[cassandra] branch trunk updated: Fix tests expecting exceptions
wrapped in RuntimeException.
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6ae6596 Fix tests expecting exceptions wrapped in RuntimeException.
6ae6596 is described below
commit 6ae65967a5ed789164192104a3e220980f952e1c
Author: Kevin Gallardo <ke...@datastax.com>
AuthorDate: Thu Apr 2 12:01:41 2020 -0400
Fix tests expecting exceptions wrapped in RuntimeException.
Patch by Kevin Gallardo, review by David Capwell and brandonwilliams for
CASSANDRA-15683.
---
.../distributed/test/SimpleReadWriteTest.java | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/test/distributed/org/apache/cassandra/distributed/test/SimpleReadWriteTest.java b/test/distributed/org/apache/cassandra/distributed/test/SimpleReadWriteTest.java
index f635a28..226331c 100644
--- a/test/distributed/org/apache/cassandra/distributed/test/SimpleReadWriteTest.java
+++ b/test/distributed/org/apache/cassandra/distributed/test/SimpleReadWriteTest.java
@@ -144,7 +144,7 @@ public class SimpleReadWriteTest extends TestBaseImpl
catch (Exception ex)
{
// the containing exception class was loaded by another class loader. Comparing the message as a workaround to assert the exception
- Assert.assertTrue(ex.getMessage().contains("org.apache.cassandra.exceptions.ReadTimeoutException"));
+ Assert.assertTrue(ex.getClass().toString().contains("ReadTimeoutException"));
long actualTimeTaken = System.currentTimeMillis() - start;
long magicDelayAmount = 100L; // it might not be the best way to check if the time taken is around the timeout value.
// Due to the delays, the actual time taken from client perspective is slighly more than the timeout value
@@ -231,14 +231,12 @@ public class SimpleReadWriteTest extends TestBaseImpl
}
catch (Exception e)
{
- Assert.assertTrue(e instanceof RuntimeException);
- RuntimeException re = ((RuntimeException) e);
// for some reason, we get weird errors when trying to check class directly
// I suppose it has to do with some classloader manipulation going on
- Assert.assertTrue(re.getCause().getClass().toString().contains("WriteFailureException"));
+ Assert.assertTrue(e.getClass().toString().contains("WriteFailureException"));
// we may see 1 or 2 failures in here, because of the fail-fast behavior of AbstractWriteResponseHandler
- Assert.assertTrue(re.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.2")
- || re.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.3"));
+ Assert.assertTrue(e.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.2")
+ || e.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.3"));
}
}
@@ -265,14 +263,12 @@ public class SimpleReadWriteTest extends TestBaseImpl
}
catch (Exception e)
{
- Assert.assertTrue(e instanceof RuntimeException);
- RuntimeException re = ((RuntimeException) e);
// for some reason, we get weird errors when trying to check class directly
// I suppose it has to do with some classloader manipulation going on
- Assert.assertTrue(re.getCause().getClass().toString().contains("ReadFailureException"));
+ Assert.assertTrue(e.getClass().toString().contains("ReadFailureException"));
// we may see 1 or 2 failures in here, because of the fail-fast behavior of ReadCallback
- Assert.assertTrue(re.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.2")
- || re.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.3"));
+ Assert.assertTrue(e.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.2")
+ || e.getMessage().contains("INCOMPATIBLE_SCHEMA from 127.0.0.3"));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org