Skip to content

Test Gateway client #587

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
35 changes: 35 additions & 0 deletions e2e-network/docker/test-05-v3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,41 @@ waitForContainer "peer0.org1.example.com" "Membership view has changed. peers we
waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1"
waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041"

# Gateway client test
GATEWAY_CLIENT_DIR="$FABLO_HOME/samples/gateway/node"
GATEWAY_CLIENT_OUTPUT_FILE="$TEST_LOGS/gateway_client.log"
echo "Testing Node.js Gateway client..."

echo "Installing gateway client dependencies..."
(cd "$GATEWAY_CLIENT_DIR" && npm install --silent --no-progress)

echo "Running Node.js Gateway client and checking output..."
(
cd "$GATEWAY_CLIENT_DIR" &&
export \
CHANNEL_NAME="my-channel1" \
CONTRACT_NAME="chaincode1" \
MSP_ID="Org1MSP" \
PEER_ORG_NAME="peer0.org1.example.com" \
PEER_GATEWAY_URL="localhost:7041" \
TLS_ROOT_CERT="$TEST_TMP/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" \
CREDENTIALS="$TEST_TMP/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]" \
PRIVATE_KEY_PEM="$TEST_TMP/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv-key.pem" &&
node server.js > "$GATEWAY_CLIENT_OUTPUT_FILE" 2>&1
)
GATEWAY_EXIT_CODE=$?

if [ $GATEWAY_EXIT_CODE -ne 0 ]; then
echo "❌ failed: Node.js Gateway client script failed with exit code $GATEWAY_EXIT_CODE."
cat "$GATEWAY_CLIENT_OUTPUT_FILE"
exit 1
fi

expectCommand "cat \"$GATEWAY_CLIENT_OUTPUT_FILE\"" "\"success\":\"OK\""

echo "🎉 Node.js Gateway client test complete 🎉"


# Test simple chaincode
expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \
'{"Args":["KVContract:put", "name", "Willy Wonka"]}' \
Expand Down
Loading