[fix] (ut) fix fe unit test failed, this is because we fix the MAX_PHYSICAL_PACKET_LENGTH to 0xffffff

This commit is contained in:
Zhengguo Yang
2021-12-06 11:13:01 +08:00
committed by GitHub
parent 6e0664bdf8
commit 200210e708
3 changed files with 9 additions and 7 deletions

View File

@ -714,10 +714,10 @@ under the License.
<configuration>
<!-->set larger, eg, 3, to reduce the time or running FE unit tests<-->
<forkCount>${fe_ut_parallel}</forkCount>
<!-->not reuse forked jvm, so that each unit test will run in separate jvm. to avoid singleton confict<-->
<!-->not reuse forked jvm, so that each unit test will run in separate jvm. to avoid singleton conflict<-->
<reuseForks>false</reuseForks>
<argLine>
-javaagent:${settings.localRepository}/org/jmockit/jmockit/1.48/jmockit-1.48.jar
-javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
</argLine>
</configuration>
</plugin>

View File

@ -20,6 +20,7 @@ package org.apache.doris.mysql;
import mockit.Delegate;
import mockit.Expectations;
import mockit.Mocked;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -99,7 +100,7 @@ public class MysqlChannelTest {
minTimes = 0;
result = new Delegate() {
int fakeRead(ByteBuffer buffer) {
int maxLen = 0xffffff - 1;
int maxLen = MysqlChannel.MAX_PHYSICAL_PACKET_LENGTH;
MysqlSerializer serializer = MysqlSerializer.newInstance();
if (readIdx == 0) {
// packet
@ -147,8 +148,8 @@ public class MysqlChannelTest {
MysqlChannel channel1 = new MysqlChannel(channel);
ByteBuffer buf = channel1.fetchOnePacket();
Assert.assertEquals(0xffffff - 1 + 10, buf.remaining());
for (int i = 0; i < 0xffffff - 1 + 10; ++i) {
Assert.assertEquals(MysqlChannel.MAX_PHYSICAL_PACKET_LENGTH + 10, buf.remaining());
for (int i = 0; i < MysqlChannel.MAX_PHYSICAL_PACKET_LENGTH + 10; ++i) {
Assert.assertEquals('a' + (i % 26), buf.get());
}
}
@ -162,7 +163,7 @@ public class MysqlChannelTest {
minTimes = 0;
result = new Delegate() {
int fakeRead(ByteBuffer buffer) {
int maxLen = 0xffffff - 1;
int maxLen = MysqlChannel.MAX_PHYSICAL_PACKET_LENGTH;
MysqlSerializer serializer = MysqlSerializer.newInstance();
if (readIdx == 0) {
// packet

View File

@ -53,6 +53,7 @@ under the License.
<skip.plugin>false</skip.plugin>
<hive.version>2.3.7</hive.version>
<hadoop.version>2.8.0</hadoop.version>
<jmockit.version>1.49</jmockit.version>
</properties>
<profiles>
@ -266,7 +267,7 @@ under the License.
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.49</version>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>