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: use "double fork" to invoke port forward within Taskfile #1148

Merged
merged 11 commits into from
Jan 14, 2025
25 changes: 12 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 @@ set -eo pipefail

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 @@ function setup_smart_contract_test ()
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,13 @@ function start_sdk_test ()
return $result
}

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


echo "Change to parent directory"
cd ../
create_test_account
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
11 changes: 5 additions & 6 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 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 Down
2 changes: 1 addition & 1 deletion src/commands/mirror_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@
.command({
command: 'destroy',
desc: 'Destroy mirror-node components and database',
builder: y => flags.setCommandFlags(y, flags.chartDirectory, flags.force, flags.namespace),
builder: y => flags.setCommandFlags(y, flags.chartDirectory, flags.force, flags.quiet, flags.namespace),

Check warning on line 678 in src/commands/mirror_node.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/mirror_node.ts#L678

Added line #L678 was not covered by tests
handler: argv => {
self.logger.info("==== Running 'mirror-node destroy' ===");
self.logger.info(argv);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@
command: 'destroy',
desc: 'Destroy JSON RPC relay',
builder: (y: any) =>
flags.setCommandFlags(y, flags.chartDirectory, flags.namespace, flags.nodeAliasesUnparsed),
flags.setCommandFlags(y, flags.chartDirectory, flags.namespace, flags.quiet, flags.nodeAliasesUnparsed),

Check warning on line 421 in src/commands/relay.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/relay.ts#L421

Added line #L421 was not covered by tests
handler: (argv: any) => {
self.logger.info("==== Running 'relay destroy' ===", {argv});
self.logger.debug(argv);
Expand Down
Loading