Skip to content

Commit dd2b0f0

Browse files
committed
fix ut
Signed-off-by: gengjun-git <gengjun@starrocks.com>
1 parent 1e88645 commit dd2b0f0

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

fe/fe-core/src/test/java/com/starrocks/catalog/ExpressionRangePartitionInfoTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -713,13 +713,5 @@ public void testExpressionRangePartitionInfoWithReservedKeywordSerializedWrong()
713713
Assertions.assertTrue(e.getMessage().contains("Getting syntax error at line 1, column 10. " +
714714
"Detail message: Unexpected input '(', the most similar input is {<EOF>}."));
715715
}
716-
717-
//the table still create successfully.
718-
Database db = GlobalStateMgr.getCurrentState().getLocalMetastore().getDb("test");
719-
Table table = db.getTable("table_reserverd_keyword_partition1");
720-
ExpressionRangePartitionInfo expressionRangePartitionInfo =
721-
(ExpressionRangePartitionInfo) ((OlapTable) table).getPartitionInfo();
722-
String exprToSql = expressionRangePartitionInfo.getPartitionExprs().get(0).toSql();
723-
Assertions.assertEquals("date_trunc('day', partition)", exprToSql);
724716
}
725717
}

fe/fe-core/src/test/java/com/starrocks/catalog/FakeEditLog.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,16 @@ public void logDropGroupProvider(GroupProviderLog groupProviderLog, WALApplier w
991991
apply(walApplier, groupProviderLog);
992992
}
993993

994+
@Mock
995+
public void logUpdateReplica(ReplicaPersistInfo info, WALApplier walApplier) {
996+
apply(walApplier, info);
997+
}
998+
999+
@Mock
1000+
public void logAddReplica(ReplicaPersistInfo info, WALApplier walApplier) {
1001+
apply(walApplier, info);
1002+
}
1003+
9941004
public TransactionState getTransaction(long transactionId) {
9951005
return allTransactionState.get(transactionId);
9961006
}

fe/fe-core/src/test/java/com/starrocks/http/ColocateMetaServiceTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import com.google.common.collect.Lists;
1818
import com.starrocks.catalog.ColocateTableIndex;
19-
import com.starrocks.catalog.FakeEditLog;
2019
import com.starrocks.http.meta.ColocateMetaService;
20+
import com.starrocks.utframe.UtFrameUtils;
2121
import org.junit.jupiter.api.Test;
2222

2323
import java.util.ArrayList;
@@ -27,11 +27,12 @@ public class ColocateMetaServiceTest {
2727

2828
@Test
2929
public void testUpdateBackendPerBucketSeq() {
30-
new FakeEditLog();
30+
UtFrameUtils.setUpForPersistTest();
3131
ColocateMetaService.BucketSeqAction action = new ColocateMetaService.BucketSeqAction(null);
3232
List<List<Long>> seqs = new ArrayList<>();
3333
seqs.add(Lists.newArrayList(1000L));
3434
ColocateTableIndex.GroupId groupId = new ColocateTableIndex.GroupId(111, 222);
3535
action.updateBackendPerBucketSeq(groupId, seqs);
36+
UtFrameUtils.tearDownForPersisTest();
3637
}
3738
}

fe/fe-core/src/test/java/com/starrocks/server/GlobalStateMgrTest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,8 @@ private GlobalStateMgr mockGlobalStateMgr() throws Exception {
131131
@Mocked
132132
ReplicationGroupAdmin replicationGroupAdmin;
133133

134-
@Mocked
135-
EditLog editLog;
136-
137134
@Test
138-
public void testUpdateFrontend() throws Exception {
135+
public void testUpdateFrontend(@Mocked EditLog editLog) throws Exception {
139136

140137
new Expectations() {
141138
{
@@ -155,12 +152,6 @@ public void updateAddress(String nodeName, String newHostName, int newPort)
155152
}
156153
};
157154

158-
new MockUp<EditLog>() {
159-
@Mock
160-
public void logUpdateFrontend(Frontend fe) {
161-
}
162-
};
163-
164155
GlobalStateMgr globalStateMgr = mockGlobalStateMgr();
165156
BDBHA ha = new BDBHA(env, "testNode");
166157
globalStateMgr.setHaProtocol(ha);
@@ -317,7 +308,6 @@ public void testErrorOccursWhileRemovingClusterIdAndRoleWhenStartAtFirstTime() {
317308
public void testReloadTables() throws Exception {
318309
ConnectContext ctx = UtFrameUtils.initCtxForNewPrivilege(UserIdentity.ROOT);
319310
UtFrameUtils.createMinStarRocksCluster();
320-
UtFrameUtils.setUpForPersistTest();
321311
GlobalStateMgr currentState = GlobalStateMgr.getCurrentState();
322312
StarRocksAssert starRocksAssert = new StarRocksAssert();
323313

fe/fe-core/src/test/java/com/starrocks/server/LocalMetastoreSimpleOpsEditLogTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ public void setUp() throws Exception {
162162

163163
@AfterEach
164164
public void tearDown() {
165+
CatalogRecycleBin recycleBin = GlobalStateMgr.getCurrentState().getRecycleBin();
166+
if (recycleBin != null) {
167+
recycleBin.removePartitionFromRecycleBin(PARTITION_ID);
168+
}
165169
UtFrameUtils.tearDownForPersisTest();
166170
}
167171

0 commit comments

Comments
 (0)