Skip to content

Commit 86d1f72

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

File tree

9 files changed

+62
-51
lines changed

9 files changed

+62
-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/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/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 {

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,15 @@ node {
106106
}
107107

108108
http {
109-
fullNodeEnable = true
110-
fullNodePort = 8090
111-
solidityEnable = true
112-
solidityPort = 8091
109+
fullNodeEnable = false
110+
solidityEnable = false
111+
PBFTEnable = false
112+
}
113+
114+
jsonrpc {
115+
httpFullNodeEnable = false
116+
httpSolidityEnable = false
117+
httpPBFTEnable = false
113118
}
114119

115120
# use your ipv6 address for node discovery and tcp connection, default false
@@ -171,6 +176,9 @@ node {
171176
}
172177

173178
rpc {
179+
enable = false
180+
solidityEnable = false
181+
PBFTEnable = false
174182
port = 50051
175183

176184
PBFTPort = 50072

plugins/src/test/java/org/tron/plugins/DbLiteTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,6 @@ public void init() throws IOException {
7777
Args.getInstance().setAllowAccountStateRoot(1);
7878
Args.getInstance().setRpcPort(PublicMethod.chooseRandomPort());
7979
Args.getInstance().setRpcEnable(true);
80-
Args.getInstance().setRpcSolidityEnable(false);
81-
Args.getInstance().setRpcPBFTEnable(false);
82-
Args.getInstance().setFullNodeHttpEnable(false);
83-
Args.getInstance().setPBFTHttpEnable(false);
84-
Args.getInstance().setSolidityNodeHttpEnable(false);
85-
Args.getInstance().setJsonRpcHttpFullNodeEnable(false);
86-
Args.getInstance().setJsonRpcHttpSolidityNodeEnable(false);
87-
Args.getInstance().setJsonRpcHttpPBFTNodeEnable(false);
8880
databaseDir = Args.getInstance().getStorage().getDbDirectory();
8981
// init dbBackupConfig to avoid NPE
9082
Args.getInstance().dbBackupConfig = DbBackupConfig.getInstance();

0 commit comments

Comments
 (0)