This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 8cd5be02cc9 Fix force startup e2e (#30397)
8cd5be02cc9 is described below
commit 8cd5be02cc98b1c53fb966a870677011958113e4
Author: ZhangCheng <[email protected]>
AuthorDate: Tue Mar 5 15:41:36 2024 +0800
Fix force startup e2e (#30397)
---
.../ReadwriteSplittingInTransactionTestCase.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
index 0fd43040029..cacc5a83500 100644
---
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
+++
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readwritesplitting/ReadwriteSplittingInTransactionTestCase.java
@@ -39,6 +39,28 @@ public final class ReadwriteSplittingInTransactionTestCase
extends BaseTransacti
super(testCaseParam);
}
+ @Override
+ protected void beforeTest() throws SQLException {
+ super.beforeTest();
+ unregisterAbnormalStoreUnitAfterForceStartup();
+ }
+
+ private void unregisterAbnormalStoreUnitAfterForceStartup() throws
SQLException {
+ try (Connection connection = getDataSource().getConnection()) {
+ ResultSet resultSet =
connection.createStatement().executeQuery("SHOW STORAGE UNITS");
+ boolean hasAbnormalStorageUnit = false;
+ while (resultSet.next()) {
+ if ("read_ds_error".equals(resultSet.getString("name"))) {
+ hasAbnormalStorageUnit = true;
+ break;
+ }
+ }
+ if (hasAbnormalStorageUnit) {
+ executeWithLog(connection, "UNREGISTER STORAGE UNIT
read_ds_error");
+ }
+ }
+ }
+
@Override
protected void executeTest(final TransactionContainerComposer
containerComposer) throws SQLException {
assertRollback();