You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by do...@apache.org on 2023/02/02 18:28:58 UTC
[accumulo-proxy] branch main updated: Add assertTrue around waitFor() blocks in SimpleProxyBase tests
This is an automated email from the ASF dual-hosted git repository.
domgarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-proxy.git
The following commit(s) were added to refs/heads/main by this push:
new 65fd1bb Add assertTrue around waitFor() blocks in SimpleProxyBase tests
65fd1bb is described below
commit 65fd1bbf2494b4ae0071ca99ce8740943a6df479
Author: DomGarguilo <do...@gmail.com>
AuthorDate: Thu Feb 2 13:28:19 2023 -0500
Add assertTrue around waitFor() blocks in SimpleProxyBase tests
---
.../apache/accumulo/proxy/its/SimpleProxyBase.java | 29 ++++++++++++++--------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java
index c3bfcbc..7af98c0 100644
--- a/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java
+++ b/src/test/java/org/apache/accumulo/proxy/its/SimpleProxyBase.java
@@ -1482,8 +1482,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
writerOptions.setThreads(1);
writerOptions.setTimeoutMs(100000);
- Wait.waitFor(() -> client.listConstraints(sharedSecret, tableName)
- .containsKey(NumericValueConstraint.class.getName()), 30_000L, 2_000L);
+ assertNumericValueConstraintIsPresent();
boolean success = false;
for (int i = 0; i < 15; i++) {
@@ -1516,8 +1515,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
client.offlineTable(sharedSecret, tableName, true);
client.onlineTable(sharedSecret, tableName, true);
- Wait.waitFor(() -> !client.listConstraints(sharedSecret, tableName)
- .containsKey(NumericValueConstraint.class.getName()), 30_000L, 2_000L);
+ assertNumericValueConstraintIsAbsent();
assertScan(new String[][] {}, tableName);
@@ -1570,8 +1568,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
log.debug("Attempting to verify client-side that constraints are observed");
- Wait.waitFor(() -> client.listConstraints(sharedSecret, tableName)
- .containsKey(NumericValueConstraint.class.getName()), 30_000L, 2_000L);
+ assertNumericValueConstraintIsPresent();
assertEquals(2, client.listConstraints(sharedSecret, tableName).size());
log.debug("Verified client-side that constraints exist");
@@ -1604,8 +1601,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
client.offlineTable(sharedSecret, tableName, true);
client.onlineTable(sharedSecret, tableName, true);
- Wait.waitFor(() -> !client.listConstraints(sharedSecret, tableName)
- .containsKey(NumericValueConstraint.class.getName()), 30_000L, 2_000L);
+ assertNumericValueConstraintIsAbsent();
assertEquals(1, client.listConstraints(sharedSecret, tableName).size());
log.debug("Verified client-side that the constraint was removed");
@@ -1955,8 +1951,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
client.offlineTable(sharedSecret, tableName, true);
client.onlineTable(sharedSecret, tableName, true);
- Wait.waitFor(() -> client.listConstraints(sharedSecret, tableName)
- .containsKey(NumericValueConstraint.class.getName()), 30_000L, 1_000L);
+ assertNumericValueConstraintIsPresent();
String cwid =
client.createConditionalWriter(sharedSecret, tableName, new ConditionalWriterOptions());
@@ -2178,6 +2173,20 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase {
"conditional writer not closed");
}
+ private void assertNumericValueConstraintIsPresent() throws Exception {
+ assertTrue(
+ Wait.waitFor(() -> client.listConstraints(sharedSecret, tableName)
+ .containsKey(NumericValueConstraint.class.getName()), 30_000L, 2_000L),
+ "Expected to find NumericValueConstraint in constraints.");
+ }
+
+ private void assertNumericValueConstraintIsAbsent() throws Exception {
+ assertTrue(
+ Wait.waitFor(() -> !client.listConstraints(sharedSecret, tableName)
+ .containsKey(NumericValueConstraint.class.getName()), 30_000L, 2_000L),
+ "Found NumericValueConstraint in constraints, expected it to be absent.");
+ }
+
private void checkKey(String row, String cf, String cq, String val, KeyValue keyValue) {
assertEquals(row, ByteBufferUtil.toString(keyValue.key.row));
assertEquals(cf, ByteBufferUtil.toString(keyValue.key.colFamily));