rpuch commented on code in PR #7188:
URL: https://github.com/apache/ignite-3/pull/7188#discussion_r2622721528
##########
modules/network/src/integrationTest/java/org/apache/ignite/internal/network/ItStaticNodeFinderTest.java:
##########
@@ -53,12 +55,27 @@ protected boolean needInitializeCluster() {
@Test
void testNodeShutdownOnNodeFinderFailure(TestInfo testInfo) {
- Throwable throwable = assertThrowsWithCause(
- () -> CLUSTER.startAndInit(testInfo, initialNodes(),
cmgMetastoreNodes(), this::configureInitParameters),
- IgniteInternalException.class);
+ LogInspector logInspector = new
LogInspector(FailureManager.class.getName());
- IgniteInternalException actual = (IgniteInternalException)
unwrapRootCause(throwable);
- Assertions.assertEquals(ADDRESS_UNRESOLVED_ERR, actual.code());
- Assertions.assertEquals("No network address found",
actual.getMessage());
+ logInspector.addHandler(
+ evt -> {
+ if (evt.getLevel() == Level.ERROR) {
+ IgniteInternalException actual =
(IgniteInternalException) unwrapRootCause(evt.getThrown());
+ assertEquals(ADDRESS_UNRESOLVED_ERR, actual.code());
+ assertEquals("No network addresses found",
actual.getMessage());
+
+ return true;
+ }
+
+ return false;
+ }, () -> assertThrows(IllegalStateException.class,
CLUSTER::aliveNode));
+
+ logInspector.start();
+
+ try {
+ CLUSTER.startAndInit(testInfo, initialNodes(),
cmgMetastoreNodes(), this::configureInitParameters);
Review Comment:
So we are not throwing the exception, right? If it's an embedded mode, it
would make sense to throw it to make it more visible to the application. If
it's not, an exception thrown here will prevent the node start. So we probably
don't need any failure manager interaction, after all...
##########
modules/network/src/integrationTest/java/org/apache/ignite/internal/network/ItStaticNodeFinderTest.java:
##########
@@ -53,12 +55,27 @@ protected boolean needInitializeCluster() {
@Test
void testNodeShutdownOnNodeFinderFailure(TestInfo testInfo) {
- Throwable throwable = assertThrowsWithCause(
- () -> CLUSTER.startAndInit(testInfo, initialNodes(),
cmgMetastoreNodes(), this::configureInitParameters),
- IgniteInternalException.class);
+ LogInspector logInspector = new
LogInspector(FailureManager.class.getName());
- IgniteInternalException actual = (IgniteInternalException)
unwrapRootCause(throwable);
- Assertions.assertEquals(ADDRESS_UNRESOLVED_ERR, actual.code());
- Assertions.assertEquals("No network address found",
actual.getMessage());
+ logInspector.addHandler(
+ evt -> {
+ if (evt.getLevel() == Level.ERROR) {
+ IgniteInternalException actual =
(IgniteInternalException) unwrapRootCause(evt.getThrown());
+ assertEquals(ADDRESS_UNRESOLVED_ERR, actual.code());
+ assertEquals("No network addresses found",
actual.getMessage());
Review Comment:
If those expectations are wrong, this will throw an error to log4j, right?
Will it propagate it further? Will junit see the test failing?
Would it be safer to have a `CountdownLatch` and count it down here, while
in the test code wait for the latch?
##########
modules/network/src/main/java/org/apache/ignite/internal/network/StaticNodeFinder.java:
##########
@@ -72,7 +78,8 @@ public Collection<NetworkAddress> findNodes() {
.collect(toSet());
if (networkAddresses.isEmpty()) {
- throw new IgniteInternalException(ADDRESS_UNRESOLVED_ERR, "No
network address found");
+ var err = new IgniteInternalException(ADDRESS_UNRESOLVED_ERR, "No
network addresses found");
Review Comment:
```suggestion
var err = new IgniteInternalException(ADDRESS_UNRESOLVED_ERR,
"No network addresses resolved through any provided names");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]