Skip to content

Commit 1c39643

Browse files
committed
fix integration tests
Signed-off-by: Nischal Sharma <[email protected]>
1 parent c34a8cb commit 1c39643

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

integration-tests/src/test/java/org/web3j/protocol/besu/BesuPrivacyQuickstartIntegrationTest.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.web3j.crypto.TransactionEncoder;
2828
import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt;
2929
import org.web3j.protocol.besu.response.privacy.PrivateTransactionWithPrivacyGroup;
30+
import org.web3j.protocol.core.methods.response.EthSendTransaction;
3031
import org.web3j.protocol.eea.crypto.PrivateTransactionEncoder;
3132
import org.web3j.protocol.eea.crypto.RawPrivateTransaction;
3233
import org.web3j.protocol.http.HttpService;
@@ -86,7 +87,7 @@ public static void setUpOnce() throws InterruptedException, IOException {
8687

8788
int blockNumber = 0;
8889
do {
89-
TimeUnit.MINUTES.sleep(1);
90+
TimeUnit.SECONDS.sleep(30);
9091
blockNumber = rpcNode.ethBlockNumber().send().getBlockNumber().intValue();
9192
} while (blockNumber <= 100);
9293
}
@@ -113,14 +114,11 @@ public void testConnection() throws IOException {
113114
public void simplePrivateTransactions() throws Exception {
114115

115116
// Build new privacy group using the create API
116-
final Base64String privacyGroupId =
117-
nodeBob.privCreatePrivacyGroup(
118-
Arrays.asList(
119-
ENCLAVE_KEY_ALICE, ENCLAVE_KEY_BOB, ENCLAVE_KEY_CHARLIE),
120-
"AliceBobCharlie",
121-
"AliceBobCharlie group")
122-
.send()
123-
.getPrivacyGroupId();
117+
Base64String privacyGroupId;
118+
do {
119+
privacyGroupId = getPrivacyGroupId();
120+
TimeUnit.SECONDS.sleep(30);
121+
} while (privacyGroupId == null);
124122

125123
final BigInteger nonce =
126124
nodeCharlie
@@ -142,9 +140,13 @@ public void simplePrivateTransactions() throws Exception {
142140
PrivateTransactionEncoder.signMessage(
143141
rawPrivateTransaction, CHAIN_ID, ALICE));
144142

145-
final String transactionHash =
146-
nodeAlice.eeaSendRawTransaction(signedTransactionData).send().getTransactionHash();
143+
EthSendTransaction eeaTransaction;
144+
do {
145+
eeaTransaction = nodeAlice.eeaSendRawTransaction(signedTransactionData).send();
146+
TimeUnit.SECONDS.sleep(30);
147+
} while (eeaTransaction.hasError());
147148

149+
final String transactionHash = eeaTransaction.getTransactionHash();
148150
final PollingPrivateTransactionReceiptProcessor receiptProcessor =
149151
new PollingPrivateTransactionReceiptProcessor(nodeAlice, 1 * 1000, 120);
150152
final PrivateTransactionReceipt receipt =
@@ -304,6 +306,15 @@ public void privacyGroupContract() throws Exception {
304306
testBalances(tokenAlice, tokenBob, BigInteger.ZERO, BigInteger.TEN);
305307
}
306308

309+
public Base64String getPrivacyGroupId() throws IOException {
310+
return nodeBob.privCreatePrivacyGroup(
311+
Arrays.asList(ENCLAVE_KEY_ALICE, ENCLAVE_KEY_BOB, ENCLAVE_KEY_CHARLIE),
312+
"AliceBobCharlie",
313+
"AliceBobCharlie group")
314+
.send()
315+
.getPrivacyGroupId();
316+
}
317+
307318
private void testBalances(
308319
final HumanStandardToken tokenAlice,
309320
final HumanStandardToken tokenBob,

integration-tests/src/test/resources/quorum-test-network/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file defines environment variables defaults for Docker-compose
22
# but we also use it for shell scripts as a sourced file
33

4-
BESU_VERSION=23.7.2
4+
BESU_VERSION=23.10.3
55
QUORUM_VERSION=23.4.0
66
TESSERA_VERSION=23.4.0
77
ETHSIGNER_VERSION=22.1.3

0 commit comments

Comments
 (0)