MINOR: Port fix to other StoreQueryIntegrationTests
Port the fix from to the other store-query tests.
Reviewers: John Roesler
@@ -71,10 +71,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.matchesRegex;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
-import static org.hamcrest.Matchers.oneOf;
+import static org.hamcrest.Matchers.anyOf;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
@@ -153,7 +152,7 @@ public class StoreQueryIntegrationTest {
"Unexpected exception thrown while getting the value from store.",
exception.getMessage(),
is(
- oneOf(
+ anyOf(
containsString("Cannot get state store source-table because the stream thread is PARTITIONS_ASSIGNED, not RUNNING"),
containsString("The state store, source-table, may have migrated to another instance")
)
@@ -243,10 +242,16 @@ public class StoreQueryIntegrationTest {
return true;
} catch (final InvalidStateStoreException exception) {
assertThat(
+ "Unexpected exception thrown while getting the value from store.",
exception.getMessage(),
- containsString("Cannot get state store source-table because the stream thread is PARTITIONS_ASSIGNED, not RUNNING")
+ is(
+ anyOf(
+ containsString("Cannot get state store source-table because the stream thread is PARTITIONS_ASSIGNED, not RUNNING"),
+ containsString("The state store, source-table, may have migrated to another instance")
+ )
+ )
);
- LOG.info("Streams wasn't running. Will try again.");
+ LOG.info("Either streams wasn't running or a re-balancing took place. Will try again.");
return false;
}
});
@@ -509,10 +514,16 @@ public class StoreQueryIntegrationTest {
return true;
} catch (final InvalidStateStoreException exception) {
assertThat(
+ "Unexpected exception thrown while getting the value from store.",
exception.getMessage(),
- matchesRegex("Cannot get state store source-table because the stream thread is (PARTITIONS_ASSIGNED|STARTING|PARTITIONS_REVOKED), not RUNNING")
+ is(
+ anyOf(
+ containsString("Cannot get state store source-table because the stream thread is PARTITIONS_ASSIGNED, not RUNNING"),
+ containsString("The state store, source-table, may have migrated to another instance")
+ )
+ )
);
- LOG.info("Streams wasn't running. Will try again.");
+ LOG.info("Either streams wasn't running or a re-balancing took place. Will try again.");
return false;
}
});
@@ -533,10 +544,16 @@ public class StoreQueryIntegrationTest {
return true;
} catch (final InvalidStateStoreException exception) {
assertThat(
+ "Unexpected exception thrown while getting the value from store.",
exception.getMessage(),
- matchesRegex("Cannot get state store source-table because the stream thread is (PARTITIONS_ASSIGNED|STARTING|PARTITIONS_REVOKED), not RUNNING")
+ is(
+ anyOf(
+ containsString("Cannot get state store source-table because the stream thread is PARTITIONS_ASSIGNED, not RUNNING"),
+ containsString("The state store, source-table, may have migrated to another instance")
+ )
+ )
);
- LOG.info("Streams wasn't running. Will try again.");
+ LOG.info("Either streams wasn't running or a re-balancing took place. Will try again.");
return false;
}
});
