Skip to content

Commit b2898ae

Browse files
committed
test(api): close api service for most test
1 parent 0e654f4 commit b2898ae

File tree

12 files changed

+71
-51
lines changed

12 files changed

+71
-51
lines changed

framework/src/test/java/org/tron/core/metrics/MetricsApiServiceTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.tron.common.application.ApplicationFactory;
1313
import org.tron.common.application.TronApplicationContext;
1414
import org.tron.common.parameter.CommonParameter;
15-
import org.tron.common.utils.PublicMethod;
1615
import org.tron.core.Constant;
1716
import org.tron.core.config.DefaultConfig;
1817
import org.tron.core.config.args.Args;
@@ -47,18 +46,6 @@ public void init() throws IOException {
4746
},
4847
"config.conf"
4948
);
50-
Args.getInstance().setRpcEnable(false);
51-
Args.getInstance().setRpcSolidityEnable(false);
52-
Args.getInstance().setRpcPBFTEnable(false);
53-
Args.getInstance().setFullNodeHttpEnable(false);
54-
Args.getInstance().setFullNodeHttpPort(PublicMethod.chooseRandomPort());
55-
Args.getInstance().setPBFTHttpEnable(false);
56-
Args.getInstance().setPBFTHttpPort(PublicMethod.chooseRandomPort());
57-
Args.getInstance().setSolidityNodeHttpEnable(false);
58-
Args.getInstance().setSolidityHttpPort(PublicMethod.chooseRandomPort());
59-
Args.getInstance().setJsonRpcHttpFullNodeEnable(false);
60-
Args.getInstance().setJsonRpcHttpSolidityNodeEnable(false);
61-
Args.getInstance().setJsonRpcHttpPBFTNodeEnable(false);
6249
CommonParameter parameter = Args.getInstance();
6350
parameter.setNodeListenPort(port);
6451
parameter.getSeedNode().getAddressList().clear();

framework/src/test/java/org/tron/core/services/RpcApiServicesTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ public static void init() throws IOException {
135135
Args.setParam(new String[]{"-d", temporaryFolder.newFolder().toString()}, Constant.TEST_CONF);
136136
String OWNER_ADDRESS = Wallet.getAddressPreFixString()
137137
+ "548794500882809695a8a687866e76d4271a1abc";
138+
getInstance().setRpcEnable(true);
138139
getInstance().setRpcPort(PublicMethod.chooseRandomPort());
140+
getInstance().setRpcSolidityEnable(true);
139141
getInstance().setRpcOnSolidityPort(PublicMethod.chooseRandomPort());
142+
getInstance().setRpcPBFTEnable(true);
140143
getInstance().setRpcOnPBFTPort(PublicMethod.chooseRandomPort());
141144
String fullNode = String.format("%s:%d", getInstance().getNodeLanIp(),
142145
getInstance().getRpcPort());

framework/src/test/java/org/tron/core/services/WalletApiTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import io.grpc.ManagedChannelBuilder;
44
import java.io.IOException;
55
import lombok.extern.slf4j.Slf4j;
6-
import org.junit.*;
6+
import org.junit.After;
7+
import org.junit.Assert;
8+
import org.junit.BeforeClass;
9+
import org.junit.ClassRule;
10+
import org.junit.Test;
711
import org.junit.rules.TemporaryFolder;
812
import org.tron.api.GrpcAPI.EmptyMessage;
913
import org.tron.api.WalletGrpc;
@@ -32,14 +36,6 @@ public static void init() throws IOException {
3236
"--p2p-disable", "true"}, Constant.TEST_CONF);
3337
Args.getInstance().setRpcPort(PublicMethod.chooseRandomPort());
3438
Args.getInstance().setRpcEnable(true);
35-
Args.getInstance().setRpcSolidityEnable(false);
36-
Args.getInstance().setRpcPBFTEnable(false);
37-
Args.getInstance().setFullNodeHttpEnable(false);
38-
Args.getInstance().setPBFTHttpEnable(false);
39-
Args.getInstance().setSolidityNodeHttpEnable(false);
40-
Args.getInstance().setJsonRpcHttpFullNodeEnable(false);
41-
Args.getInstance().setJsonRpcHttpSolidityNodeEnable(false);
42-
Args.getInstance().setJsonRpcHttpPBFTNodeEnable(false);
4339
context = new TronApplicationContext(DefaultConfig.class);
4440
appT = ApplicationFactory.create(context);
4541
appT.startup();

framework/src/test/java/org/tron/core/services/filter/HttpApiAccessFilterTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,12 @@ public class HttpApiAccessFilterTest extends BaseTest {
3939
static {
4040
Args.setParam(new String[]{"-d", dbPath()}, Constant.TEST_CONF);
4141
Args.getInstance().setFullNodeAllowShieldedTransactionArgs(false);
42-
Args.getInstance().setRpcEnable(false);
43-
Args.getInstance().setRpcSolidityEnable(false);
44-
Args.getInstance().setRpcPBFTEnable(false);
4542
Args.getInstance().setFullNodeHttpEnable(true);
4643
Args.getInstance().setFullNodeHttpPort(PublicMethod.chooseRandomPort());
4744
Args.getInstance().setPBFTHttpEnable(true);
4845
Args.getInstance().setPBFTHttpPort(PublicMethod.chooseRandomPort());
4946
Args.getInstance().setSolidityNodeHttpEnable(true);
5047
Args.getInstance().setSolidityHttpPort(PublicMethod.chooseRandomPort());
51-
Args.getInstance().setJsonRpcHttpFullNodeEnable(false);
52-
Args.getInstance().setJsonRpcHttpSolidityNodeEnable(false);
53-
Args.getInstance().setJsonRpcHttpPBFTNodeEnable(false);
5448
}
5549

5650
@Test

framework/src/test/java/org/tron/core/services/filter/LiteFnQueryGrpcInterceptorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ public class LiteFnQueryGrpcInterceptorTest {
5555
@BeforeClass
5656
public static void init() throws IOException {
5757
Args.setParam(new String[]{"-d", temporaryFolder.newFolder().toString()}, Constant.TEST_CONF);
58+
Args.getInstance().setRpcEnable(true);
5859
Args.getInstance().setRpcPort(PublicMethod.chooseRandomPort());
60+
Args.getInstance().setRpcSolidityEnable(true);
5961
Args.getInstance().setRpcOnSolidityPort(PublicMethod.chooseRandomPort());
62+
Args.getInstance().setRpcPBFTEnable(true);
6063
Args.getInstance().setRpcOnPBFTPort(PublicMethod.chooseRandomPort());
6164
String fullnode = String.format("%s:%d", Args.getInstance().getNodeLanIp(),
6265
Args.getInstance().getRpcPort());

framework/src/test/java/org/tron/core/services/filter/RpcApiAccessInterceptorTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ public class RpcApiAccessInterceptorTest {
5656
@BeforeClass
5757
public static void init() throws IOException {
5858
Args.setParam(new String[] {"-d", temporaryFolder.newFolder().toString()}, Constant.TEST_CONF);
59+
Args.getInstance().setRpcEnable(true);
5960
Args.getInstance().setRpcPort(PublicMethod.chooseRandomPort());
61+
Args.getInstance().setRpcSolidityEnable(true);
6062
Args.getInstance().setRpcOnSolidityPort(PublicMethod.chooseRandomPort());
63+
Args.getInstance().setRpcPBFTEnable(true);
6164
Args.getInstance().setRpcOnPBFTPort(PublicMethod.chooseRandomPort());
6265
String fullNode = String.format("%s:%d", Args.getInstance().getNodeLanIp(),
6366
Args.getInstance().getRpcPort());

framework/src/test/java/org/tron/core/services/http/TriggerSmartContractServletTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,8 @@ public static void init() throws Exception {
3333
Args.setParam(
3434
new String[]{"--output-directory", dbPath(), "--debug", "--witness"}, Constant.TEST_CONF);
3535
Args.getInstance().needSyncCheck = false;
36-
Args.getInstance().setRpcEnable(false);
37-
Args.getInstance().setRpcSolidityEnable(false);
38-
Args.getInstance().setRpcPBFTEnable(false);
3936
Args.getInstance().setFullNodeHttpEnable(true);
4037
Args.getInstance().setFullNodeHttpPort(PublicMethod.chooseRandomPort());
41-
Args.getInstance().setPBFTHttpEnable(false);
42-
Args.getInstance().setSolidityNodeHttpEnable(false);
43-
Args.getInstance().setJsonRpcHttpFullNodeEnable(false);
44-
Args.getInstance().setJsonRpcHttpSolidityNodeEnable(false);
45-
Args.getInstance().setJsonRpcHttpPBFTNodeEnable(false);
4638
httpNode = String.format("%s:%d", "127.0.0.1",
4739
Args.getInstance().getFullNodeHttpPort());
4840
}

framework/src/test/resources/config-localtest.conf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,21 @@ node {
116116
]
117117

118118
http {
119-
fullNodePort = 8090
120-
solidityPort = 8091
119+
fullNodeEnable = false
120+
solidityEnable = false
121+
PBFTEnable = false
122+
}
123+
124+
jsonrpc {
125+
httpFullNodeEnable = false
126+
httpSolidityEnable = false
127+
httpPBFTEnable = false
121128
}
122129

123130
rpc {
131+
enable = false
132+
solidityEnable = false
133+
PBFTEnable = false
124134
port = 50051
125135
# default value is 50061
126136
# solidityPort = 50061

framework/src/test/resources/config-test-index.conf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,23 @@ node {
7676
version = 43 # 43: testnet; 101: debug
7777
}
7878

79+
http {
80+
fullNodeEnable = false
81+
solidityEnable = false
82+
PBFTEnable = false
83+
}
84+
85+
jsonrpc {
86+
httpFullNodeEnable = false
87+
httpSolidityEnable = false
88+
httpPBFTEnable = false
89+
}
90+
7991
rpc {
8092
port = 50051
81-
93+
enable = false
94+
solidityEnable = false
95+
PBFTEnable = false
8296
# Number of gRPC thread, default availableProcessors / 2
8397
# thread = 16
8498

framework/src/test/resources/config-test-mainnet.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@ node {
8282
version = 43 # 43: testnet; 101: debug
8383
}
8484

85+
http {
86+
fullNodeEnable = false
87+
solidityEnable = false
88+
PBFTEnable = false
89+
}
90+
91+
jsonrpc {
92+
httpFullNodeEnable = false
93+
httpSolidityEnable = false
94+
httpPBFTEnable = false
95+
}
96+
97+
rpc {
98+
enable = false
99+
solidityEnable = false
100+
PBFTEnable = false
101+
}
102+
85103
}
86104

87105
sync {

0 commit comments

Comments
 (0)