diff --git a/src/integration-test/java/com/lmax/solana4j/programs/IntegrationTestBase.java b/src/integration-test/java/com/lmax/solana4j/programs/IntegrationTestBase.java index d083603..e2d6c39 100644 --- a/src/integration-test/java/com/lmax/solana4j/programs/IntegrationTestBase.java +++ b/src/integration-test/java/com/lmax/solana4j/programs/IntegrationTestBase.java @@ -24,9 +24,11 @@ public abstract class IntegrationTestBase { SOLANA_VALIDATOR = new GenericContainer<>(new ImageFromDockerfile().withDockerfile(Path.of(MountableFile.forClasspathResource("Dockerfile").getFilesystemPath()))) .withCopyFileToContainer(MountableFile.forClasspathResource("solana-run.sh"), "/solana-run.sh") - .withCopyFileToContainer(MountableFile.forClasspathResource("lmax_multisig.so"), "/multisig/lmax_multisig.so") + .withCopyFileToContainer(MountableFile.forClasspathResource("lmax_multisig.so"), "/lmax_multisig.so") + .withCopyFileToContainer(MountableFile.forClasspathResource("upgrade_authority.json"), "/upgrade_authority.json") + .withCopyFileToContainer(MountableFile.forClasspathResource("bpf_program.json"), "/bpf_program.json") .withExposedPorts(SOLANA_HTTP_PORT, SOLANA_WS_PORT) - .withEnv("SOLANA_RUN_SH_VALIDATOR_ARGS", "--bpf-program CxmAHzszTVSWmtBnCXda7eUTemd8DGyax88yYk54A2PT /multisig/lmax_multisig.so --ticks-per-slot=8") + .withEnv("SOLANA_RUN_SH_VALIDATOR_ARGS", "--ticks-per-slot=8") .withNetwork(NETWORK); SOLANA_VALIDATOR.start(); diff --git a/src/integration-test/resources/bpf_program.json b/src/integration-test/resources/bpf_program.json new file mode 100644 index 0000000..b9a4e1c --- /dev/null +++ b/src/integration-test/resources/bpf_program.json @@ -0,0 +1 @@ +[61,196,159,98,23,173,199,31,231,199,114,186,197,109,57,63,107,200,112,213,255,160,241,57,77,236,166,195,202,255,88,144,177,185,110,204,245,183,13,245,247,158,124,13,207,38,93,189,174,177,67,96,65,158,117,67,213,221,149,207,228,39,63,146] \ No newline at end of file diff --git a/src/integration-test/resources/solana-run.sh b/src/integration-test/resources/solana-run.sh index f2fda11..59f3a9a 100644 --- a/src/integration-test/resources/solana-run.sh +++ b/src/integration-test/resources/solana-run.sh @@ -88,20 +88,36 @@ else $SOLANA_RUN_SH_GENESIS_ARGS fi -abort() { - set +e - kill "$validator" - wait "$validator" -} -trap abort INT TERM EXIT - args=( --ledger "$ledgerDir" --gossip-port 8001 --rpc-port 8899 ) + # shellcheck disable=SC2086 solana-test-validator "${args[@]}" $SOLANA_RUN_SH_VALIDATOR_ARGS & validator=$! -wait "$validator" \ No newline at end of file + +solana config set --url "http://localhost:8899" + +set +e +while true; do + + solana ping --count 1 > /dev/null 2>&1 + + if [ $? -eq 0 ]; then + echo "Solana RPC is responsive!" + break + else + echo "Waiting for Solana RPC to become responsive..." + fi + sleep 0.5 +done +set -e + +solana program deploy /lmax_multisig.so --program-id /bpf_program.json --upgrade-authority /upgrade_authority.json +#solana program show CxmAHzszTVSWmtBnCXda7eUTemd8DGyax88yYk54A2PT + +wait "$validator" + diff --git a/src/integration-test/resources/upgrade_authority.json b/src/integration-test/resources/upgrade_authority.json new file mode 100644 index 0000000..4ffd764 --- /dev/null +++ b/src/integration-test/resources/upgrade_authority.json @@ -0,0 +1 @@ +[202,101,0,209,102,238,230,73,253,213,87,196,29,150,233,22,76,33,202,41,139,151,4,110,169,33,68,147,253,94,157,215,0,179,40,133,43,36,208,40,29,110,65,126,205,211,111,151,29,241,182,112,20,241,41,84,12,181,176,237,207,139,117,228] \ No newline at end of file