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 Integration Tests #1294

Merged
merged 10 commits into from Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions integration-tests/build.gradle
@@ -1,4 +1,3 @@

description 'web3j integration tests'

dependencies {
Expand All @@ -8,9 +7,18 @@ dependencies {
project(':geth')
testCompile "ch.qos.logback:logback-core:$logbackVersion",
"ch.qos.logback:logback-classic:$logbackVersion",
"com.carrotsearch:junit-benchmarks:$junitBenchmarkVersion"
"com.carrotsearch:junit-benchmarks:$junitBenchmarkVersion",
"org.web3j:web3j-unit:$web3jUnitVersion"
}
tasks.withType(Test) {
useJUnitPlatform()
systemProperties = [
'junit.jupiter.extensions.autodetection.enabled': 'true',
'junit.jupiter.testinstance.lifecycle.default' : 'per_class'
]
}


// we don't want integration tests to run by default
test.enabled = project.hasProperty('integration-tests') ?
project.getProperty('integration-tests') : false
AlexandrouR marked this conversation as resolved.
Show resolved Hide resolved
project.getProperty('integration-tests') : true
8 changes: 5 additions & 3 deletions integration-tests/src/test/java/org/web3j/ens/EnsIT.java
Expand Up @@ -12,19 +12,21 @@
*/
package org.web3j.ens;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.web3j.EVMTest;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;

import static org.junit.jupiter.api.Assertions.assertEquals;

@Disabled
AlexandrouR marked this conversation as resolved.
Show resolved Hide resolved
@EVMTest
public class EnsIT {

@Test
public void testEns() throws Exception {
public void testEns(Web3j web3j) throws Exception {

Web3j web3j = Web3j.build(new HttpService());
EnsResolver ensResolver = new EnsResolver(web3j);

assertEquals(
Expand Down
Expand Up @@ -33,7 +33,7 @@
* <p>Generated with web3j version 4.0.1.
xaviarias marked this conversation as resolved.
Show resolved Hide resolved
*/
public class Fibonacci extends Contract {
private static final String BINARY = "608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a723058201b9d0941154b95636fb5e4225fefd5c2c460060efa5f5e40c9826dce08814af80029";
public static final String BINARY = "608060405234801561001057600080fd5b5061014f806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633c7fdc70811461005057806361047ff41461007a575b600080fd5b34801561005c57600080fd5b50610068600435610092565b60408051918252519081900360200190f35b34801561008657600080fd5b506100686004356100e0565b600061009d826100e0565b604080518481526020810183905281519293507f71e71a8458267085d5ab16980fd5f114d2d37f232479c245d523ce8d23ca40ed929081900390910190a1919050565b60008115156100f15750600061011e565b81600114156101025750600161011e565b61010e600283036100e0565b61011a600184036100e0565b0190505b9190505600a165627a7a723058201b9d0941154b95636fb5e4225fefd5c2c460060efa5f5e40c9826dce08814af80029";
xaviarias marked this conversation as resolved.
Show resolved Hide resolved

public static final String FUNC_FIBONACCINOTIFY = "fibonacciNotify";

Expand Down
Expand Up @@ -22,6 +22,8 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.web3j.EVMTest;
import org.web3j.NodeType;
import org.web3j.crypto.Credentials;
import org.web3j.generated.HumanStandardToken;
import org.web3j.protocol.besu.response.privacy.PrivacyGroup;
Expand All @@ -34,9 +36,13 @@
import org.web3j.tx.response.PollingPrivateTransactionReceiptProcessor;
import org.web3j.utils.Base64String;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Disabled
AlexandrouR marked this conversation as resolved.
Show resolved Hide resolved
@EVMTest(type = NodeType.BESU)
public class BesuOnChainPrivacyIntegrationTest {

private static final Credentials ALICE =
Expand All @@ -52,17 +58,18 @@ public class BesuOnChainPrivacyIntegrationTest {
Base64String.wrap("Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=");
private static final Base64String ENCLAVE_KEY_CHARLIE =
Base64String.wrap("k2zXEin4Ip/qBGlRkJejnGWdP9cjkK+DAvKNW31L2C8=");

private static final BesuPrivacyGasProvider ZERO_GAS_PROVIDER =
new BesuPrivacyGasProvider(BigInteger.valueOf(0));
private static Besu nodeAlice;
private static Besu nodeBob;
private static Besu nodeCharlie;
private static PollingPrivateTransactionReceiptProcessor processor;

@BeforeAll
public static void setUpOnce() {
nodeAlice = Besu.build(new HttpService("http://localhost:20000"));
nodeBob = Besu.build(new HttpService("http://localhost:20002"));
nodeCharlie = Besu.build(new HttpService("http://localhost:20004"));
nodeAlice = Besu.build(new HttpService("http://localhost:8545"));
nodeBob = Besu.build(new HttpService("http://localhost:8545"));
nodeCharlie = Besu.build(new HttpService("http://localhost:8545"));
AlexandrouR marked this conversation as resolved.
Show resolved Hide resolved
processor = new PollingPrivateTransactionReceiptProcessor(nodeAlice, 1000, 15);
}

Expand All @@ -72,9 +79,6 @@ static byte[] generateRandomBytes(int size) {
return bytes;
}

private static final BesuPrivacyGasProvider ZERO_GAS_PROVIDER =
new BesuPrivacyGasProvider(BigInteger.valueOf(0));

@Test
public void testCreateAndFindOnChainPrivacyGroup() throws Exception {
Base64String privacyGroupId = Base64String.wrap(generateRandomBytes(32));
Expand Down