Skip to content

Commit b1023bc

Browse files
committed
IGNITE-28000 Update error handling checks in tests
1 parent fd4dc7d commit b1023bc

3 files changed

Lines changed: 34 additions & 9 deletions

File tree

modules/runner/src/integrationTest/java/org/apache/ignite/internal/table/ItDataConsistencyTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.concurrent.atomic.LongAdder;
3434
import org.apache.ignite.Ignite;
3535
import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
36+
import org.apache.ignite.internal.client.ClientRetriableTransactionException;
3637
import org.apache.ignite.lang.IgniteException;
3738
import org.apache.ignite.table.Table;
3839
import org.apache.ignite.table.Tuple;
@@ -217,6 +218,12 @@ private Runnable createWriter(int workerId) {
217218
} catch (TransactionException e) {
218219
// Don't need to rollback manually if got IgniteException.
219220
fails.increment();
221+
} catch (ClientRetriableTransactionException e) {
222+
if (e.getCause() instanceof TransactionException) {
223+
fails.increment();
224+
} else {
225+
throw e;
226+
}
220227
}
221228
}
222229
};
@@ -261,6 +268,12 @@ private Runnable createReader(int workerId) {
261268
readOps.increment();
262269
} catch (TransactionException e) {
263270
readFails.increment();
271+
} catch (ClientRetriableTransactionException e) {
272+
if (e.getCause() instanceof TransactionException) {
273+
readFails.increment();
274+
} else {
275+
throw e;
276+
}
264277
}
265278
}
266279
};

modules/security/src/integrationTest/java/org/apache/ignite/internal/ssl/ItSslTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717

1818
package org.apache.ignite.internal.ssl;
1919

20+
import static java.util.Collections.emptyList;
2021
import static org.apache.ignite.internal.testframework.IgniteTestUtils.escapeWindowsPath;
2122
import static org.apache.ignite.internal.testframework.IgniteTestUtils.getResourcePath;
2223
import static org.apache.ignite.internal.testframework.matchers.CompletableFutureExceptionMatcher.willThrow;
2324
import static org.apache.ignite.internal.testframework.matchers.CompletableFutureExceptionMatcher.willTimeoutIn;
2425
import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
2526
import static org.apache.ignite.jdbc.util.JdbcTestUtils.assertThrowsSqlException;
27+
import static org.apache.ignite.lang.ErrorGroups.Client.CLIENT_SSL_CONFIGURATION_ERR;
2628
import static org.hamcrest.MatcherAssert.assertThat;
2729
import static org.hamcrest.Matchers.hasSize;
2830
import static org.hamcrest.Matchers.is;
@@ -46,6 +48,7 @@
4648
import org.apache.ignite.internal.Cluster.ServerRegistration;
4749
import org.apache.ignite.internal.ClusterConfiguration;
4850
import org.apache.ignite.internal.ClusterPerClassIntegrationTest;
51+
import org.apache.ignite.internal.IgniteExceptionTestUtils;
4952
import org.apache.ignite.internal.testframework.TestIgnitionManager;
5053
import org.apache.ignite.internal.testframework.WorkDirectory;
5154
import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
@@ -239,11 +242,13 @@ void clientCanNotConnectWithSslAndInvalidTrustStorePassword() {
239242
}
240243
});
241244

242-
assertThat(ex.getMessage(), is("Client SSL configuration error: keystore password was incorrect"));
243-
// Exceptions thrown from the synchronous build method are copied to include the sync method
244-
assertThat(ex.getCause(), isA(IgniteClientConnectionException.class));
245-
assertThat(ex.getCause().getCause(), isA(IOException.class));
246-
assertThat(ex.getCause().getCause().getMessage(), is("keystore password was incorrect"));
245+
IgniteExceptionTestUtils.publicException(
246+
IgniteClientConnectionException.class,
247+
CLIENT_SSL_CONFIGURATION_ERR,
248+
"Client SSL configuration error: keystore password was incorrect",
249+
emptyList()
250+
).withCause(isA(IOException.class));
251+
assertThat(ex.getCause().getMessage(), is("keystore password was incorrect"));
247252
}
248253

249254
@Test

modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItPkOnlyTableCrossApiTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
package org.apache.ignite.internal.sql.engine;
1919

20+
import static java.util.Collections.emptyList;
21+
import static org.apache.ignite.internal.IgniteExceptionTestUtils.publicException;
2022
import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
2123
import static org.apache.ignite.internal.sql.engine.util.SqlTestUtils.assertThrowsSqlException;
24+
import static org.apache.ignite.lang.ErrorGroups.Marshalling.COMMON_ERR;
2225
import static org.apache.ignite.lang.ErrorGroups.Sql.CONSTRAINT_VIOLATION_ERR;
23-
import static org.hamcrest.MatcherAssert.assertThat;
24-
import static org.hamcrest.Matchers.instanceOf;
25-
import static org.hamcrest.Matchers.is;
26+
import static org.hamcrest.Matchers.any;
2627
import static org.junit.jupiter.api.Assertions.assertEquals;
2728
import static org.junit.jupiter.api.Assertions.assertFalse;
2829
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -157,7 +158,13 @@ public void testKeyValueView(TestEnvironment env) {
157158
rwTx -> {
158159
IgniteException ex = assertThrows(IgniteException.class,
159160
() -> tab.keyValueView(KeyObject.class, Integer.class).put(rwTx, key, 1));
160-
assertThat(ex.getCause().getCause(), is(instanceOf(MarshallerException.class)));
161+
162+
publicException(
163+
MarshallerException.class,
164+
COMMON_ERR,
165+
"",
166+
emptyList()
167+
).withMessage(any(String.class));
161168

162169
kvView.put(rwTx, key, null);
163170

0 commit comments

Comments
 (0)