Skip to content

ci(integration testing): test examples against cardano-node #44

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 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
09e3dc2
Add CI script draft
mark-stopka Dec 29, 2020
5583ac0
Fix formatting
mark-stopka Dec 29, 2020
95abd87
Fix formatting
mark-stopka Dec 29, 2020
2b9b431
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Dec 31, 2020
51c3305
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Jan 7, 2021
c184490
Update CI workflow
mark-stopka Jan 9, 2021
446f3bc
Add SPDX header
mark-stopka Jan 9, 2021
a719dd4
refactor: basic code
mark-stopka Jan 9, 2021
0948a0c
Fix formating
mark-stopka Jan 9, 2021
640ac50
Add cardano-node integration tests to workflow
mark-stopka Jan 9, 2021
ccc332e
Update GH Action
mark-stopka Jan 9, 2021
ce43e7f
Fix typo
mark-stopka Jan 9, 2021
dd911ba
Add executable permisions to script
mark-stopka Jan 9, 2021
be28c7d
fix(testnet setup)
mark-stopka Jan 9, 2021
92fbec4
Add Shelley Genesis INIT script
mark-stopka Jan 9, 2021
c823687
Refactor integration environment initialization
mark-stopka Jan 11, 2021
15c235b
Fix Cardano Node inetgration testing workflow
mark-stopka Jan 11, 2021
f1627d4
refactor(workflow): Integration testing
mark-stopka Jan 11, 2021
ed93354
fix: script name
mark-stopka Jan 11, 2021
33d6b37
ci(refactor): Minor script updates
mark-stopka Jan 11, 2021
720171a
ci: improve scripts
mark-stopka Jan 11, 2021
7b31cea
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Mar 16, 2021
75dd9fc
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Apr 6, 2021
5507664
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Sep 22, 2021
d080895
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Dec 29, 2021
d5e1b52
Merge branch 'master' into ci-test-examples-agains-cardano-node
mark-stopka Jan 26, 2022
59229ee
Merge branch 'main' into ci-test-examples-agains-cardano-node
mark-stopka Jan 29, 2022
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
4 changes: 4 additions & 0 deletions .github/tests/00-cardano-node-integration-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM 2ndlayer/centos-cardano-node:1.24.2

COPY srv/cardano/cardano-node/etc/config.yaml /srv/cardano/cardano-node/etc/
COPY usr/local/lib /usr/local/lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -e

# © 2020 PERLUR Group
#
# SPDX-License-Identifier: GPL-3.0-only OR LGPL-3.0-only

if ! which jq >> /dev/null 2>&1; then
echo "ERROR: jq binary is missing!"
exit 0
fi
if ! which docker >> /dev/null 2>&1; then
echo "ERROR: docker binary is missing!"
exit 0
fi
if ! cd ${PWD}/.github/tests/00-cardano-node-integration-tests/; then
echo "ERROR: Failed to switch to cardano-node-integration-tests directory!"
fi

GH_JSON=$(curl --proto '=https' --tlsv1.2 -sSf "https://api.github.com/repos/input-output-hk/cardano-node/releases/latest")
if [ $(jq -r .prerelease <<< ${GH_JSON}) == false ]; then
cardanoNodeVersionTag=$(jq -r .tag_name <<< ${GH_JSON})
echo "Discovered Cardano Node ${cardanoNodeVersionTag}"
cardanoNodeVersion=${cardanoNodeVersionTag}
fi

sed -i "s/<cardanoNodeVersionTag>/${cardanoNodeVersionTag}/" \
${PWD}/Dockerfile

echo "Pull Docker image from Docker Hub"
if ! docker pull 2ndlayer/centos-cardano-node:${cardanoNodeVersion} >> /dev/null 2>&1; then
echo "ERROR: Docker image pull failed!"
exit 0
else TESTNET_MAGIC=${RANDOM}
docker build -t local/cardano-node-shelley-testnet:${cardanoNodeVersion} ./

if docker run local/cardano-node-shelley-testnet:${cardanoNodeVersion} \
bash /usr/local/lib/cardano-node-integration-testing-create-testnet.sh;
then
CONTAINER_ID=$(docker ps -aq | head -n 1)
if docker commit ${CONTAINER_ID} local/cardano-node-shelley-testnet:${cardanoNodeVersion}; then
echo "INFO: Initial testing Shelley environment commited!"
fi
if docker run \
local/cardano-node-shelley-testnet:${cardanoNodeVersion} \
bash /usr/local/lib/cardano-node-integration-testing-update-genesis.sh;
then
echo "INFO: Testnet INIT scripts executed!"
if docker commit ${CONTAINER_ID} local/cardano-node-shelley-testnet:${cardanoNodeVersion}; then
echo "DEBUG: Image name: local/cardano-node-shelley-testnet:${cardanoNodeVersion}"
fi
else
echo "ERROR: Failed to execute testnet INIT scripts!"
exit 0
fi
else
echo "ERROR: Failed to create Shelley testing environment!"
exit 0
fi
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"TurnOnLogging": true,
"TurnOnLogMetrics": true,
"TracingVerbosity": "NormalVerbosity",
"minSeverity": "Debug",
"TraceBlockFetchClient": false,
"TraceBlockFetchDecisions": false,
"TraceBlockFetchProtocol": false,
"TraceBlockFetchProtocolSerialised": false,
"TraceBlockFetchServer": false,
"TraceBlockchainTime": false,
"TraceChainDb": true,
"TraceChainSyncBlockServer": false,
"TraceChainSyncClient": false,
"TraceChainSyncHeaderServer": false,
"TraceChainSyncProtocol": false,
"TraceDNSResolver": true,
"TraceDNSSubscription": true,
"TraceErrorPolicy": true,
"TraceForge": true,
"TraceHandshake": false,
"TraceIpSubscription": true,
"TraceLocalChainSyncProtocol": false,
"TraceLocalErrorPolicy": true,
"TraceLocalHandshake": false,
"TraceLocalTxSubmissionProtocol": false,
"TraceLocalTxSubmissionServer": false,
"TraceMempool": true,
"TraceMux": false,
"TraceTxInbound": false,
"TraceTxOutbound": false,
"TraceTxSubmissionProtocol": false,
"setupBackends": [
"KatipBK"
],
"defaultBackends": [
"KatipBK"
],
"hasEKG": 12788,
"hasPrometheus": [
"127.0.0.1",
12798
],
"setupScribes": [
{
"scFormat": "ScText",
"scKind": "StdoutSK",
"scName": "stdout",
"scRotation": null
}
],
"defaultScribes": [
[
"StdoutSK",
"stdout"
]
],
"rotation": {
"rpKeepFilesNum": 10,
"rpLogLimitBytes": 5000000,
"rpMaxAgeHours": 24
},
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
set -e

# © 2020 PERLUR Group
#
# SPDX-License-Identifier: GPL-3.0-only OR LGPL-3.0-only

# Print diagnostic information
echo "PWD:" $(pwd)

TESTNET_MAGIC=${RANDOM}

if cardano-cli genesis create \
--genesis-dir testnet \
--gen-utxo-keys 3 \
--supply 100000 \
--testnet-magic ${TESTNET_MAGIC};
then
echo "INFO: Initial testing Shelley environment created!"
else
echo "ERROR: Initial testing Shelley environment creation failed!"
exit 0
fi


#
# Modify genesis.spec.json
#

TMP_FILE=$(mktemp)
cat testnet/genesis.spec.json | jq .epochLength=300 > ${TMP_FILE}
cat ${TMP_FILE} \
| jq .protocolParams.decentralisationParam=0 > testnet/genesis.spec.json

rm ${TMP_FILE}

#
# Modify genesis.json
#

TMP_FILE=$(mktemp)
cat testnet/genesis.json | jq .epochLength=300 > ${TMP_FILE}
cat ${TMP_FILE} \
| jq .protocolParams.decentralisationParam=0 > etc/genesis.json
cp ${TMP_FILE} testnet/genesis.json

rm ${TMP_FILE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -e

# © 2020 PERLUR Group
#
# SPDX-License-Identifier: GPL-3.0-only OR LGPL-3.0-only

# Print diagnostic information
echo "PWD:" $(pwd)

#
# Modify genesis.spec.json
#

TMP_FILE=$(mktemp)
cat testnet/genesis.spec.json | jq .epochLength=300 > ${TMP_FILE}
cat ${TMP_FILE} \
| jq .protocolParams.decentralisationParam=0 > testnet/genesis.spec.json

rm ${TMP_FILE}

#
# Modify genesis.json
#

TMP_FILE=$(mktemp)
cat testnet/genesis.json | jq .epochLength=300 > ${TMP_FILE}
cat ${TMP_FILE} \
| jq .protocolParams.decentralisationParam=0 > etc/genesis.json
cp ${TMP_FILE} testnet/genesis.json

rm ${TMP_FILE}
17 changes: 17 additions & 0 deletions .github/workflows/cardano-node-integration-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Cardano Node Integration Testing

on:
push:
pull_request:
branches: [ master ]

jobs:
prepare_testnet_shelley:
name: Prepare Cardano Node Testnet - Shelley
runs-on: ubuntu-latest

steps:
- name: Prepare Git environment
uses: actions/checkout@v2
- name: Build Cardano Node Shelley Testnet Docker Images
run: bash .github/tests/00-cardano-node-integration-tests/prepare-cardano-node-shelley-testnet-environment.sh