Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug for unit test #926

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
sh install.sh

- name: Cache Maven packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-2022-11-30-${{ hashFiles('**/pom.xml') }}
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/com/ctrip/xpipe/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected boolean assertSuccess(Runnable assertion) {

protected void waitConditionUntilTimeOut(BooleanSupplier booleanSupplier) throws TimeoutException {

waitConditionUntilTimeOut(booleanSupplier, 5000, 2);
waitConditionUntilTimeOut(booleanSupplier, 10000, 2);
}

protected void waitConditionUntilTimeOut(BooleanSupplier booleanSupplier, int waitTimeMilli) throws TimeoutException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import com.ctrip.xpipe.redis.keeper.AbstractRedisKeeperTest;
import com.ctrip.xpipe.redis.keeper.RedisKeeperServer;
import com.ctrip.xpipe.redis.keeper.RedisMaster;
import com.ctrip.xpipe.redis.keeper.config.DefaultKeeperConfig;
import com.ctrip.xpipe.redis.keeper.config.DefaultKeeperResourceManager;
import com.ctrip.xpipe.redis.keeper.config.KeeperResourceManager;
import com.ctrip.xpipe.redis.keeper.config.TestKeeperConfig;
import com.ctrip.xpipe.redis.keeper.monitor.KeeperMonitor;
import com.ctrip.xpipe.simpleserver.Server;
import com.ctrip.xpipe.utils.DefaultLeakyBucket;
Expand Down Expand Up @@ -80,6 +82,7 @@ public void beforeDefaultRedisMasterReplicationTest() throws Exception {
defaultRedisMasterReplication = new DefaultRedisMasterReplication(redisMaster, redisKeeperServer, nioEventLoopGroup,
scheduled, proxyResourceManager);
when(redisKeeperServer.getRedisKeeperServerState()).thenReturn(new RedisKeeperServerStateActive(redisKeeperServer));
when(redisKeeperServer.getKeeperConfig()).thenReturn(new TestKeeperConfig());

when(redisMaster.getCurrentReplicationStore()).thenReturn(replicationStore);
when(replicationStore.getMetaStore()).thenReturn(metaStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void startKeeperServerAndTestReFullSync(int fileToKeep, int maxTransferC

RedisKeeperServer redisKeeperServer = startRedisKeeperServerAndConnectToFakeRedis(fileToKeep, maxTransferCommnadsSize, 1000);
int keeperPort = redisKeeperServer.getListeningPort();
sleep(3000);
sleep(5000);
logger.info(remarkableMessage("send psync to redump rdb"));

int rdbDumpCount1 = ((DefaultReplicationStore)redisKeeperServer.getReplicationStore()).getRdbUpdateCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void redisFailWhileSendingRdb() throws Exception {
logger.info(remarkableMessage("[redisFailWhileSendingRdb]"));
InMemoryPsync inMemoryPsync = sendInmemoryPsync("localhost", redisKeeperServer.getListeningPort());

sleep(1500);
sleep(3000);
assertPsyncResultEquals(inMemoryPsync);

}
Expand All @@ -67,7 +67,7 @@ public void redisFailKeeperRestartDumpNewRdb() throws Exception {
SimplePsyncObserver simplePsyncObserver = new SimplePsyncObserver();
InMemoryPsync inMemoryPsync = sendInmemoryPsync("localhost", redisKeeperServer.getListeningPort(), simplePsyncObserver);
//wait
simplePsyncObserver.getOnline().get(5000, TimeUnit.MILLISECONDS);
simplePsyncObserver.getOnline().get(6000, TimeUnit.MILLISECONDS);
//wait for commands
sleep(1000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void testByteBufReleasedAfterPipelineBroken() {
ByteBuf byteBuf = Unpooled.copiedBuffer("test".getBytes());
channel.writeInbound(byteBuf);
Assert.assertEquals(0, byteBuf.refCnt());
Assert.assertFalse(channel.isOpen());
Mockito.verify(session).release();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
Expand Down Expand Up @@ -114,7 +115,7 @@ public void testByteBufReleasedAfterPipelineBroken() {
ByteBuf byteBuf = Unpooled.copiedBuffer("test".getBytes());
channel.writeInbound(byteBuf);
Assert.assertEquals(0, byteBuf.refCnt());
Assert.assertFalse(channel.isOpen());
Mockito.verify(session).release();
}

}
Loading