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

chore: account init before relay deployment #1154

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/flow-task-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
example-task-file-test:
timeout-minutes: 20
runs-on: solo-linux-large
strategy:
matrix:
type: ["NO_ACCOUNT_INIT", "ACCOUNT_INIT"]
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
Expand All @@ -63,9 +66,8 @@ jobs:
verbosity: 3
wait: 120s

- name: Run Example Task File Test
- name: Run Example Task File Test with type ${{ matrix.type }}
run: |
task default-with-relay
sleep 10
.github/workflows/script/solo_smoke_test.sh
task default-with-mirror
.github/workflows/script/solo_smoke_test.sh ${{ matrix.type }}
task clean
4 changes: 3 additions & 1 deletion .github/workflows/script/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function create_test_account ()

# get private key of the account
npm run solo-test -- account get -n solo-e2e --account-id ${OPERATOR_ID} --private-key > test.log
export OPERATOR_KEY=$(grep "privateKey" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')

# retrieve the field privateKey but not privateKeyRaw
export OPERATOR_KEY=$(grep "privateKey" test.log | grep -v "privateKeyRaw" | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
export CONTRACT_TEST_KEY_ONE=0x$(grep "privateKeyRaw" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "CONTRACT_TEST_KEY_ONE=${CONTRACT_TEST_KEY_ONE}"
rm test.log
Expand Down
41 changes: 28 additions & 13 deletions .github/workflows/script/solo_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@

source .github/workflows/script/helper.sh

function enable_port_forward ()
{
kubectl port-forward -n solo-e2e svc/haproxy-node1-svc 50211:50211 > /dev/null 2>&1 &
kubectl port-forward -n solo-e2e svc/hedera-explorer 8080:80 > /dev/null 2>&1 &
kubectl port-forward -n solo-e2e svc/relay-node1-hedera-json-rpc-relay 7546:7546 > /dev/null 2>&1 &
kubectl port-forward -n solo-e2e svc/mirror-grpc 5600:5600 > /dev/null 2>&1 &
}

function clone_smart_contract_repo ()
{
echo "Clone hedera-smart-contracts"
Expand Down Expand Up @@ -50,6 +42,17 @@
cd -
}

function check_port_forward ()
{
# run background task for few minutes
for i in {1..20}
do
echo "Check port forward"
ps -ef |grep port-forward
sleep 5
done &
}

function start_background_transactions ()
{
echo "Start background transaction"
Expand Down Expand Up @@ -83,17 +86,29 @@
return $result
}

echo "Restart port-forward"
task clean:port-forward
enable_port_forward


echo "Change to parent directory"
cd ../
create_test_account

cd solo
# if first parameter equals to ACCOUNT_INIT,
# then call solo account init before deploy relay node
if [ "$1" == "ACCOUNT_INIT" ]; then
echo "Call solo account init"
npm run solo-test -- account init -n solo-e2e

npm run solo-test -- relay deploy -n solo-e2e -i node1 --operator-key $OPERATOR_KEY --operator-id $OPERATOR_ID

Check warning on line 100 in .github/workflows/script/solo_smoke_test.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/script/solo_smoke_test.sh#L100

Double quote to prevent globbing and word splitting.
kubectl port-forward -n solo-e2e svc/relay-node1-hedera-json-rpc-relay 7546:7546 > /dev/null 2>&1 &

else
task solo:relay
fi
cd -

clone_smart_contract_repo
setup_smart_contract_test
start_background_transactions
check_port_forward
start_contract_test
start_sdk_test
echo "Sleep a while to wait background transactions to finish"
Expand Down
15 changes: 7 additions & 8 deletions Taskfile.helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ tasks:
SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node start --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} ${DEBUG_NODE_FLAG} -q {{ .CLI_ARGS }} --dev
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
echo "Enable port forwarding for Hedera Network Node"
echo "Port forwarding for Hedera Network Node: grpc:50211"
nohup kubectl port-forward -n "${SOLO_NAMESPACE}" pod/network-node1-0 50211:50211 < /dev/null > {{.temp_prefix}}-50211-nohup.out 2>&1 &
/bin/bash -c "nohup kubectl port-forward -n \"${SOLO_NAMESPACE}\" svc/haproxy-node1-svc 50211:50211 > /dev/null 2>&1 &"
sleep 4
fi

Expand All @@ -245,7 +244,7 @@ tasks:
- |
if [[ "{{ .use_port_forwards }}" == "true" ]];then
echo "Enable port forwarding for Hedera JSON RPC Relay"
nohup kubectl port-forward -n "${SOLO_NAMESPACE}" svc/relay-node1-hedera-json-rpc-relay 7546:7546 &
/bin/bash -c "nohup kubectl port-forward -n \"${SOLO_NAMESPACE}\" svc/relay-node1-hedera-json-rpc-relay 7546:7546 > /dev/null 2>&1 &"
sleep 4
fi

Expand All @@ -257,7 +256,7 @@ tasks:
deps:
- task: "init"
cmds:
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- relay destroy -n "${SOLO_NAMESPACE}" -i node1 -q --dev
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- relay destroy -n "${SOLO_NAMESPACE}" -i node1 --dev

solo:cache:remove:
silent: true
Expand Down Expand Up @@ -426,10 +425,10 @@ tasks:
if [[ "{{ .use_port_forwards }}" == "true" ]];then
echo "Enable port forwarding for Hedera Explorer & Mirror Node Network"
echo "Port forwarding for Hedera Explorer: http://localhost:6789"
nohup kubectl port-forward -n "${SOLO_NAMESPACE}" svc/hedera-explorer 6789:80 < /dev/null > {{.temp_prefix}}-6789-nohup.out 2>&1 &
/bin/bash -c "nohup kubectl port-forward -n \"${SOLO_NAMESPACE}\" svc/hedera-explorer 8080:80 > /dev/null 2>&1 &"
echo "Port forwarding for Mirror Node Network: grpc:5600, rest:5551"
nohup kubectl port-forward svc/mirror-grpc -n "${SOLO_NAMESPACE}" 5600:5600 < /dev/null > {{.temp_prefix}}-5600-nohup.out 2>&1 &
nohup kubectl port-forward svc/mirror-rest -n "${SOLO_NAMESPACE}" 5551:80 < /dev/null > {{.temp_prefix}}-5551-nohup.out 2>&1 &
/bin/bash -c "nohup kubectl port-forward -n \"${SOLO_NAMESPACE}\" svc/mirror-grpc 5600:5600 > /dev/null 2>&1 &"
/bin/bash -c "nohup kubectl port-forward -n \"${SOLO_NAMESPACE}\" svc/mirror-rest 5551:80 > /dev/null 2>&1 &"
sleep 4
fi

Expand All @@ -442,7 +441,7 @@ tasks:
deps:
- task: "init"
cmds:
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- mirror-node destroy --namespace "${SOLO_NAMESPACE}" --force -q --dev || true
- SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- mirror-node destroy --namespace "${SOLO_NAMESPACE}" --force --dev || true

clean:
desc: destroy, then remove cache directory, logs directory, config, and port forwards
Expand Down
Loading