Skip to content

Commit

Permalink
Added dynamic geth init and removed geth datadir.
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Terry <mark.terry@consensys.net>
  • Loading branch information
mark-terry committed Mar 30, 2021
1 parent e962ba4 commit 85e3492
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;

import com.github.dockerjava.api.command.CreateContainerCmd;
import org.awaitility.Awaitility;
import org.awaitility.core.ThrowingRunnable;
import org.junit.After;
Expand All @@ -30,7 +32,6 @@
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.MountableFile;
import org.web3j.crypto.CipherException;
import org.web3j.crypto.Credentials;
import org.web3j.protocol.Web3j;
Expand Down Expand Up @@ -88,6 +89,7 @@ public class ContainerTestBase {

// GoQuorum config
private final String goQuorumContainerDatadir = "/tmp/qdata/";
private final String goQuorumContainerGenesis = "/tmp/qdata/genesis.json";
private final String goQuorumContainerGethIpcPath = goQuorumContainerDatadir + "/geth.ipc";
private final Integer goQuorumP2pPort = 30303;
private final Integer goQuorumRpcPort = 8545;
Expand Down Expand Up @@ -230,30 +232,37 @@ private GenericContainer buildGoQuorumContainer(
.withNetwork(containerNetwork)
.dependsOn(tesseraGoQuorumContainer)
.withExposedPorts(goQuorumRpcPort, goQuorumP2pPort)
.withCopyFileToContainer(
MountableFile.forClasspathResource("/goQuorum/qdata/"), goQuorumContainerDatadir)
.withClasspathResourceMapping(
"/goQuorum/qdata/", goQuorumContainerDatadir, BindMode.READ_ONLY)
.withClasspathResourceMapping(hostGenesisPath, goQuorumContainerGenesis, BindMode.READ_ONLY)
.withClasspathResourceMapping(ipcPath, ipcBindDir, BindMode.READ_WRITE)
.withEnv("PRIVATE_CONFIG", containerIpcPath)
.withCommand(
"--datadir",
goQuorumContainerDatadir,
"--networkid",
networkId.toString(),
"--rpc",
"--rpcaddr",
"0.0.0.0",
"--rpcport",
goQuorumRpcPort.toString(),
"--rpcapi",
"admin,eth,debug,miner,net,shh,txpool,personal,web3,quorum,quorumExtension,clique",
"--emitcheckpoints",
"--port",
goQuorumP2pPort.toString(),
"--verbosity",
"3",
"--nousb",
"--nodekey",
goQuorumContainerDatadir + "/nodeKey");
.withCreateContainerCmdModifier(
(Consumer<CreateContainerCmd>)
cmd ->
cmd.withEntrypoint(
"/bin/ash",
"-c",
"geth init " + goQuorumContainerGenesis + " --datadir "
+ goQuorumContainerDatadir
+ " && geth --datadir "
+ goQuorumContainerDatadir
+ " --networkid "
+ networkId.toString()
+ " --rpc"
+ " --rpcaddr 0.0.0.0"
+ " --rpcport "
+ goQuorumRpcPort.toString()
+ " --rpcapi admin,eth,debug,miner,net,shh,txpool,personal,web3,quorum,quorumExtension,clique"
+ " --emitcheckpoints"
+ " --port "
+ goQuorumP2pPort.toString()
+ " --verbosity"
+ " 3"
+ " --nousb"
+ " --nodekey "
+ goQuorumContainerDatadir
+ "/nodeKey"));
}

private Quorum buildWeb3JQuorum(final String containerIpAddress, final Integer mappedPort) {
Expand Down

This file was deleted.

Empty file.

This file was deleted.

Binary file not shown.

This file was deleted.

Empty file.

This file was deleted.

Binary file not shown.
2 changes: 1 addition & 1 deletion ethereum/referencetests/src/test/resources
Submodule resources updated 243 files

0 comments on commit 85e3492

Please sign in to comment.