mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-17 20:55:04 +01:00
Fixed tests to be compatible with docker-compose
This commit is contained in:
@@ -558,7 +558,7 @@ exec_in_test_container_leave_lf apk add --update curl coreutils openssl
|
|||||||
|
|
||||||
# Copy keys to test container
|
# Copy keys to test container
|
||||||
trace 1 "\n\n[test_gatekeeper] ${BCyan}Copying keys and certs to test container...${Color_Off}\n"
|
trace 1 "\n\n[test_gatekeeper] ${BCyan}Copying keys and certs to test container...${Color_Off}\n"
|
||||||
gatekeeperid=$(docker ps -q -f "name=cyphernode_gatekeeper")
|
gatekeeperid=$(docker ps -q -f "name=cyphernode.gatekeeper")
|
||||||
testid=$(docker ps -q -f "name=tests-gatekeeper")
|
testid=$(docker ps -q -f "name=tests-gatekeeper")
|
||||||
docker cp ${gatekeeperid}:/etc/nginx/conf.d/keys.properties - | docker cp - ${testid}:/
|
docker cp ${gatekeeperid}:/etc/nginx/conf.d/keys.properties - | docker cp - ${testid}:/
|
||||||
docker cp ${gatekeeperid}:/etc/ssl/certs/cert.pem - | docker cp - ${testid}:/
|
docker cp ${gatekeeperid}:/etc/ssl/certs/cert.pem - | docker cp - ${testid}:/
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ mine() {
|
|||||||
local minedaddr
|
local minedaddr
|
||||||
|
|
||||||
echo ; echo "About to mine ${nbblocks} block(s)..."
|
echo ; echo "About to mine ${nbblocks} block(s)..."
|
||||||
minedaddr=$(docker exec -t $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat getnewaddress | tr -d '\r')
|
minedaddr=$(docker exec -t $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat getnewaddress | tr -d '\r')
|
||||||
echo ; echo "minedaddr=${minedaddr}"
|
echo ; echo "minedaddr=${minedaddr}"
|
||||||
docker exec -t $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat generatetoaddress ${nbblocks} "${minedaddr}"
|
docker exec -t $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat generatetoaddress ${nbblocks} "${minedaddr}"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${0}" in *mine.sh) mine $@;; esac
|
case "${0}" in *mine.sh) mine $@;; esac
|
||||||
|
|||||||
@@ -73,10 +73,12 @@ test_manage_missed_0_conf() {
|
|||||||
trace 3 "[test_manage_missed_0_conf] response=${response}"
|
trace 3 "[test_manage_missed_0_conf] response=${response}"
|
||||||
|
|
||||||
trace 3 "[test_manage_missed_0_conf] Shutting down the proxy..."
|
trace 3 "[test_manage_missed_0_conf] Shutting down the proxy..."
|
||||||
docker stop $(docker ps -q -f "name=proxy\.")
|
# There are two container names containing "proxy": proxy and proxycron
|
||||||
|
# Let's exclude proxycron
|
||||||
|
docker restart $(docker ps -q -f "name=proxy[^c]")
|
||||||
|
|
||||||
trace 3 "[test_manage_missed_0_conf] Sending coins to watched address while proxy is down..."
|
trace 3 "[test_manage_missed_0_conf] Sending coins to watched address while proxy is down..."
|
||||||
docker exec -it $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address} 0.0001
|
docker exec -it $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address} 0.0001
|
||||||
# txid1=$(exec_in_test_container curl -d '{"address":"'${address}'","amount":0.0001}' proxy:8888/spend | jq -r ".txid")
|
# txid1=$(exec_in_test_container curl -d '{"address":"'${address}'","amount":0.0001}' proxy:8888/spend | jq -r ".txid")
|
||||||
|
|
||||||
wait_for_proxy
|
wait_for_proxy
|
||||||
@@ -113,14 +115,16 @@ test_manage_missed_1_conf() {
|
|||||||
trace 3 "[test_manage_missed_1_conf] response=${response}"
|
trace 3 "[test_manage_missed_1_conf] response=${response}"
|
||||||
|
|
||||||
trace 3 "[test_manage_missed_1_conf] Sending coins to watched address while proxy is up..."
|
trace 3 "[test_manage_missed_1_conf] Sending coins to watched address while proxy is up..."
|
||||||
docker exec -it $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address} 0.0001
|
docker exec -it $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address} 0.0001
|
||||||
# txid1=$(exec_in_test_container curl -d '{"address":"'${address}'","amount":0.0001}' proxy:8888/spend | jq -r ".txid")
|
# txid1=$(exec_in_test_container curl -d '{"address":"'${address}'","amount":0.0001}' proxy:8888/spend | jq -r ".txid")
|
||||||
|
|
||||||
trace 3 "[test_manage_missed_1_conf] Sleeping for 20 seconds to let the 0-conf callbacks to happen..."
|
trace 3 "[test_manage_missed_1_conf] Sleeping for 20 seconds to let the 0-conf callbacks to happen..."
|
||||||
sleep 20
|
sleep 20
|
||||||
|
|
||||||
trace 3 "[test_manage_missed_1_conf] Shutting down the proxy..."
|
trace 3 "[test_manage_missed_1_conf] Shutting down the proxy..."
|
||||||
docker stop $(docker ps -q -f "name=proxy\.")
|
# There are two container names containing "proxy": proxy and proxycron
|
||||||
|
# Let's exclude proxycron
|
||||||
|
docker restart $(docker ps -q -f "name=proxy[^c]")
|
||||||
|
|
||||||
trace 3 "[test_manage_missed_1_conf] Mine a new block..."
|
trace 3 "[test_manage_missed_1_conf] Mine a new block..."
|
||||||
mine
|
mine
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ test_watches() {
|
|||||||
trace 2 "\n\n[test_watches] ${BCyan}10. Send coins to address1...${Color_Off}\n"
|
trace 2 "\n\n[test_watches] ${BCyan}10. Send coins to address1...${Color_Off}\n"
|
||||||
start_callback_server 1111
|
start_callback_server 1111
|
||||||
# Let's use the bitcoin node directly to better simulate an external spend
|
# Let's use the bitcoin node directly to better simulate an external spend
|
||||||
txid=$(docker exec -it $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address1} 0.0001 | tr -d "\r\n")
|
txid=$(docker exec -it $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address1} 0.0001 | tr -d "\r\n")
|
||||||
# txid=$(exec_in_test_container curl -d '{"address":"'${address1}'","amount":0.001}' proxy:8888/spend | jq -r ".txid")
|
# txid=$(exec_in_test_container curl -d '{"address":"'${address1}'","amount":0.001}' proxy:8888/spend | jq -r ".txid")
|
||||||
trace 3 "[test_watches] txid=${txid}"
|
trace 3 "[test_watches] txid=${txid}"
|
||||||
trace 3 "[test_watches] Waiting for 0-conf callback on address1..."
|
trace 3 "[test_watches] Waiting for 0-conf callback on address1..."
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ test_watch_pub32() {
|
|||||||
trace 2 "\n\n[test_watch_pub32] ${BCyan}12. Send coins to address1...${Color_Off}\n"
|
trace 2 "\n\n[test_watch_pub32] ${BCyan}12. Send coins to address1...${Color_Off}\n"
|
||||||
start_callback_server 1111
|
start_callback_server 1111
|
||||||
# Let's use the bitcoin node directly to better simulate an external spend
|
# Let's use the bitcoin node directly to better simulate an external spend
|
||||||
txid1=$(docker exec -it $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address1} 0.0001 | tr -d "\r\n")
|
txid1=$(docker exec -it $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address1} 0.0001 | tr -d "\r\n")
|
||||||
# txid1=$(exec_in_test_container curl -d '{"address":"'${address1}'","amount":0.001}' proxy:8888/spend | jq -r ".txid")
|
# txid1=$(exec_in_test_container curl -d '{"address":"'${address1}'","amount":0.001}' proxy:8888/spend | jq -r ".txid")
|
||||||
trace 3 "[test_watch_pub32] txid1=${txid1}"
|
trace 3 "[test_watch_pub32] txid1=${txid1}"
|
||||||
trace 3 "[test_watch_pub32] Waiting for 0-conf callback on address1..."
|
trace 3 "[test_watch_pub32] Waiting for 0-conf callback on address1..."
|
||||||
@@ -282,7 +282,7 @@ test_watch_pub32() {
|
|||||||
trace 2 "\n\n[test_watch_pub32] ${BCyan}13. Send coins to address2...${Color_Off}\n"
|
trace 2 "\n\n[test_watch_pub32] ${BCyan}13. Send coins to address2...${Color_Off}\n"
|
||||||
start_callback_server 1113
|
start_callback_server 1113
|
||||||
# Let's use the bitcoin node directly to better simulate an external spend
|
# Let's use the bitcoin node directly to better simulate an external spend
|
||||||
txid2=$(docker exec -it $(docker ps -q -f "name=cyphernode_bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address2} 0.0001 | tr -d "\r\n")
|
txid2=$(docker exec -it $(docker ps -q -f "name=cyphernode.bitcoin") bitcoin-cli -rpcwallet=spending01.dat sendtoaddress ${address2} 0.0001 | tr -d "\r\n")
|
||||||
# txid2=$(exec_in_test_container curl -d '{"address":"'${address2}'","amount":0.001}' proxy:8888/spend | jq -r ".txid")
|
# txid2=$(exec_in_test_container curl -d '{"address":"'${address2}'","amount":0.001}' proxy:8888/spend | jq -r ".txid")
|
||||||
trace 3 "[test_watch_pub32] txid2=${txid2}"
|
trace 3 "[test_watch_pub32] txid2=${txid2}"
|
||||||
trace 3 "[test_watch_pub32] Waiting for 0-conf callback on address2..."
|
trace 3 "[test_watch_pub32] Waiting for 0-conf callback on address2..."
|
||||||
|
|||||||
Reference in New Issue
Block a user