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

DEV 841: Further docker, tests improvements #280

Merged
merged 45 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9a75f31
Restructure tests
askolesov Feb 11, 2022
155189a
Remove libindy
askolesov Feb 11, 2022
f264a26
Remove docker-localnet image
askolesov Feb 11, 2022
6fdd4f6
New docker compose draft
askolesov Feb 11, 2022
3dbb39d
Comment out build section
ankurdotb Feb 11, 2022
06d9676
Fix docker builds
askolesov Feb 13, 2022
bf83691
Merge branch 'DEV-841' of https://github.com/cheqd/cheqd-node into DE…
askolesov Feb 13, 2022
bf8984b
Working docker-compose based localnet
askolesov Feb 15, 2022
095ebc8
Fix doc
askolesov Feb 15, 2022
4da78e5
Fix localnet setup
askolesov Feb 15, 2022
de21c86
Fix image name
askolesov Feb 15, 2022
c628e3a
Fix test paths
askolesov Feb 15, 2022
026539c
Fix paths
askolesov Feb 15, 2022
80b3cf0
Fix paths
askolesov Feb 15, 2022
d217cc0
Expose RPC ports
askolesov Feb 15, 2022
746ac1f
Add docker version output
askolesov Feb 15, 2022
b1188b7
Print docker compose version
askolesov Feb 15, 2022
a030f3a
Docker compose version
askolesov Feb 15, 2022
d88973e
Revert docker compose version print
askolesov Feb 15, 2022
11f5cf2
Fix paths
askolesov Feb 15, 2022
139627b
Make other steps to use compose based localnet
askolesov Feb 15, 2022
d03a807
Remove testnet image building and publishing
askolesov Feb 15, 2022
5cc114e
Fix ports
askolesov Feb 15, 2022
1c21d9e
Comment external address
askolesov Feb 15, 2022
5aa0037
Remove external address from localnet nodes
askolesov Feb 15, 2022
b6d2f4e
Fix paths
askolesov Feb 15, 2022
f8a79fa
Get rid of configure mapping in docker entrypoint script
askolesov Feb 16, 2022
fc194c6
Add api, consensus configuration to localnet
askolesov Feb 16, 2022
668107c
Fix paths in the upgrade test
askolesov Feb 16, 2022
f507775
Fix linter issues
askolesov Feb 16, 2022
13c40ec
For the previous commit
askolesov Feb 16, 2022
b59cca4
Make container.env to utilize cosmos native env vars
askolesov Feb 16, 2022
d2f6c49
Revert unnecessary changes
askolesov Feb 16, 2022
d55bc43
Add new line at the EOF
askolesov Feb 16, 2022
ca6f0f5
Remove remainings of the testnet image
askolesov Feb 16, 2022
65d83c4
Extract env vars of testnet into separate files
askolesov Feb 16, 2022
b743a7a
Fix images publishing
askolesov Feb 17, 2022
9a71cc1
Move import-keys script to localnet
askolesov Feb 18, 2022
5af71e5
Set default minimum gas prices for localnet
askolesov Feb 18, 2022
d22dd5c
Set CREATE_EMPTY_BLOCKS to false
askolesov Feb 21, 2022
5700dba
Replace PAT with GITHUB_TOKEN
askolesov Feb 21, 2022
573b132
Fix registry name in release pipeline
askolesov Feb 21, 2022
f946b60
Add missing seed_mode
askolesov Feb 21, 2022
24a7f46
Fix panic in case of invalid key format (#284)
askolesov Feb 21, 2022
0f0abef
Merge branch 'DEV-841' of https://github.com/cheqd/cheqd-node into DE…
askolesov Feb 22, 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
62 changes: 11 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,41 +155,14 @@ jobs:
name: cheqd-node-image.tar
path: cheqd-node-image.tar

build-testnet-image:
name: Build cheqd-testnet image
runs-on: ubuntu-20.04
needs: build-node-images
steps:
- name: Check out
uses: actions/checkout@v2

- name: Download node image
uses: actions/download-artifact@v2
with:
name: cheqd-cli-image.tar

- name: Load node image
run: docker load -i cheqd-cli-image.tar

- name: Build
run: docker build -f tests/networks/docker-localnet/Dockerfile --no-cache -t cheqd-testnet .

- name: Save
run: docker save -o cheqd-testnet-image.tar cheqd-testnet

- name: Store artifact
uses: actions/upload-artifact@v2
with:
name: cheqd-testnet-image.tar
path: cheqd-testnet-image.tar

publish:
name: "Publish images and release"
# Reference to workflow-setup job is required to access its various outputs.
needs: [ build-binary, build-node-images, build-testnet-image, build-deb-package, build-tar-package ]
needs: [ build-binary, build-node-images, build-deb-package, build-tar-package ]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.build-binary.outputs.VERSION }}
REGISTRY: ghcr.io
steps:
- name: Git checkout
uses: actions/checkout@v2
Expand All @@ -210,17 +183,12 @@ jobs:
- name: Load cheqd-node image
run: docker load -i cheqd-node-image.tar

- name: Download testnet image
uses: actions/download-artifact@v2
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
name: cheqd-testnet-image.tar

- name: Load testnet image
run: docker load -i cheqd-testnet-image.tar

- name: Login to docker
run: |
echo ${{ secrets.GH_PAT }} | docker login ghcr.io --username ${{ secrets.GH_USER }} --password-stdin
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push cheqd-node image
run: |
Expand All @@ -229,20 +197,12 @@ jobs:
docker push ghcr.io/${{ github.repository }}:${{ env.VERSION }}
docker push ghcr.io/${{ github.repository }}:latest


- name: Push cheqd-cli image
run: |
docker tag cheqd-cli ghcr.io/${{ env.GITHUB_ORG_NAME }}/cheqd-cli:${{ env.VERSION }}
docker tag cheqd-cli ghcr.io/${{ env.GITHUB_ORG_NAME }}/cheqd-cli:latest
docker push ghcr.io/${{ env.GITHUB_ORG_NAME }}:${{ env.VERSION }}
docker push ghcr.io/${{ env.GITHUB_ORG_NAME }}:latest

- name: Push testnet image
run: |
docker tag cheqd-testnet ghcr.io/${{ github.repository_owner }}/cheqd-testnet:${{ env.VERSION }}
docker tag cheqd-testnet ghcr.io/${{ github.repository_owner }}/cheqd-testnet:latest
docker push ghcr.io/${{ github.repository_owner }}/cheqd-testnet:${{ env.VERSION }}
docker push ghcr.io/${{ github.repository_owner }}/cheqd-testnet:latest
docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }}
docker tag cheqd-cli ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest
docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:${{ env.VERSION }}
docker push ghcr.io/${{ github.repository_owner }}/cheqd-cli:latest

- name: Download deb
uses: actions/download-artifact@v2
Expand Down
120 changes: 49 additions & 71 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ on:
- '.gitbook/**'

env:
NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/tests/networks/docker-compose-localnet/network-config"
NODE_CONFIGS_BASE: "/home/runner/work/cheqd-node/cheqd-node/docker/localnet/network-config"

jobs:

run-unit-test:
name: Run unit tests
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -175,34 +174,6 @@ jobs:
name: cheqd-node-image.tar
path: cheqd-node-image.tar

build-testnet-image:
name: Build cheqd-testnet image
runs-on: ubuntu-20.04
needs: build-node-images
steps:
- name: Check out
uses: actions/checkout@v2

- name: Download node image
uses: actions/download-artifact@v2
with:
name: cheqd-cli-image.tar

- name: Load node image
run: docker load -i cheqd-cli-image.tar

- name: Build
run: docker build -f tests/networks/docker-localnet/Dockerfile --no-cache -t cheqd-testnet .

- name: Save
run: docker save -o cheqd-testnet-image.tar cheqd-testnet

- name: Store artifact
uses: actions/upload-artifact@v2
with:
name: cheqd-testnet-image.tar
path: cheqd-testnet-image.tar

test-new-node-setup-from-deb:
name: Test new node setup from deb
runs-on: ubuntu-20.04
Expand All @@ -221,34 +192,34 @@ jobs:
- name: Download node image
uses: actions/download-artifact@v2
with:
name: cheqd-cli-image.tar
name: cheqd-node-image.tar

- name: Load node image
run: docker load -i cheqd-cli-image.tar
run: docker load -i cheqd-node-image.tar

- name: Check out
uses: actions/checkout@v2

- name: Set up 4 validators + 2 observers node docker pool # TODO: Replace with testnet image
working-directory: ./tests/networks/docker-compose-localnet
- name: Set up 4 validators + 2 observers node docker pool
working-directory: ./docker/localnet
run: |
bash gen-network-config.sh
docker-compose up -d
CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d

- name: Wait for chain
run: bash tests/networks/tools/wait-for-chain.sh
run: bash tests/tools/wait-for-chain.sh

- name: Add observer node
working-directory: ./tests/networks/docker-compose-localnet
working-directory: ./tests/e2e-complex/deb-install
run: |
./add-observer.sh
cheqd-noded status -n tcp://localhost:26677 2>&1
./wait.sh '[[ $(cheqd-noded status -n '"'"'tcp://localhost:26677'"'"' 2>&1 | wc -l) == 1 ]] && echo "New node returns status!"'

- name: Promote observer to validator
working-directory: ./tests/networks/docker-compose-localnet
working-directory: ./tests/e2e-complex/deb-install
run: |
bash -x promote-validator.sh
bash promote-validator.sh
cheqd-noded query staking validators --node "http://localhost:26657" | sed -nr 's/.*status: (.*?).*/\1/p' $1 | while read x; do [[ "BOND_STATUS_BONDED" == $x ]] && echo "Validator's status is bonded!" || exit 1 ; done
./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*signature": (.*?).*/\1/p'"'"' | wc -l) == 5 ]] && echo "There are 5 validators signatures in block!"'
./wait.sh '[[ $(curl -s localhost:26657/block | sed -nr '"'"'s/.*(signature": null).*/\1/p'"'"' | wc -l) == 0 ]] && echo "There are no null signatures in block!"'
Expand All @@ -258,11 +229,6 @@ jobs:
run: |
journalctl -ex | grep cheqd

- name: Gather logs on failure 2
if: ${{ failure() }}
run: |
journalctl -u service-name.service --no-pager

run-python-based-integration-tests:
name: Run python based cosmos and identity tests
runs-on: ubuntu-20.04
Expand All @@ -280,50 +246,51 @@ jobs:
- name: Download node image
uses: actions/download-artifact@v2
with:
name: cheqd-cli-image.tar
name: cheqd-node-image.tar

- name: Load node image
run: docker load -i cheqd-cli-image.tar
run: docker load -i cheqd-node-image.tar

- uses: actions/checkout@v2
- name: Check out
uses: actions/checkout@v2

- name: Set up 4 validators + 2 observers node docker pool for local test run # Replace with testnet image
working-directory: ./tests/networks/docker-compose-localnet
- name: Set up 4 validators + 2 observers node docker pool
working-directory: ./docker/localnet
run: |
bash gen-network-config.sh
docker-compose up -d
CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d
ankurdotb marked this conversation as resolved.
Show resolved Hide resolved

- name: Wait for chain
run: bash tests/networks/tools/wait-for-chain.sh
run: bash tests/tools/wait-for-chain.sh

- name: Set up test environment
working-directory: ./tests/e2e
working-directory: ./tests/e2e-pytest
run: |
pip3 install -r requirements.txt >> /dev/null
cp -Rf ${NODE_CONFIGS_BASE}/validator-0/. /home/runner/.cheqdnode
cp -Rf ${NODE_CONFIGS_BASE}/validator-1/. /home/runner/.cheqdnode
sudo chmod -R 777 /home/runner

- name: Run cosmos-related tests
working-directory: ./tests/e2e-pytest
run: |
set -euxo pipefail
export OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-0" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g')
export OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" --home "${NODE_CONFIGS_BASE}/validator-1" | sed -nr 's/.*address: (.*?).*/\1/p' | sed 's/\r//g')
pytest -v -rP tests/e2e/test_cosmos.py
pytest -v -rP test_cosmos.py

- name: Run identity-related tests # TODO: Move into separate stage?
working-directory: ./tests/e2e-pytest
run: |
export OP0_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 1p | sed 's/\r//g')
export OP1_ADDRESS=$(cheqd-noded keys list --keyring-backend "test" | sed -nr 's/.*address: (.*?).*/\1/p' | sed -n 2p | sed 's/\r//g')
pytest -v -rP tests/e2e/test_identity.py
pytest -v -rP test_identity.py

run-bash-based-integration-tests:
name: Run bash based identity tests
runs-on: ubuntu-20.04
needs: [build-binary, build-testnet-image]
needs: [build-binary, build-node-images]
steps:
- uses: actions/checkout@v2

- name: Load binary artifact
uses: actions/download-artifact@v2
with:
Expand All @@ -333,23 +300,34 @@ jobs:
- name: Restore binary permissions
run: sudo chmod +x /home/runner/.local/bin/cheqd-noded

- name: Download testnet image
- name: Download node image
uses: actions/download-artifact@v2
with:
name: cheqd-testnet-image.tar
name: cheqd-node-image.tar

- name: Load testnet image
run: docker load -i cheqd-testnet-image.tar
- name: Load node image
run: docker load -i cheqd-node-image.tar

- name: Run test net container
- name: Check out
uses: actions/checkout@v2

- name: Set up 4 validators + 2 observers node docker pool
working-directory: ./docker/localnet
run: |
docker run -d --rm -p "26657:26657" -p "1317:1317" cheqd-testnet
bash tests/networks/tools/wait-for-chain.sh
bash gen-network-config.sh
CHEQD_NODE_IMAGE=cheqd-node CHEQD_NODE_VERSION=latest docker compose up -d

- name: Set up and run tests
working-directory: tests/cli
- name: Wait for chain
run: bash tests/tools/wait-for-chain.sh

- name: Import keys
working-directory: docker/localnet
run: |
bash import_keys.sh

- name: Set up and run tests
working-directory: tests/e2e-bash
run: |
bash run_all.sh

run-upgrade-test-positive-case:
Expand All @@ -361,25 +339,25 @@ jobs:
with:
fetch-depth: 0 # It's needed for getting the full version of package by `git describe`

- name: Download node image
- name: Download cli image
uses: actions/download-artifact@v2
with:
name: cheqd-cli-image.tar

- name: Load node image
- name: Load cli image
run: docker load -i cheqd-cli-image.tar

- name: Chown for current user
run: sudo chown $USER:$USER .

- name: Prepare nodes for checking upgrade
working-directory: ./tests/upgrade
working-directory: ./tests/e2e-complex/upgrade
run: bash prepare.sh

- name: Initiate the upgrade process
working-directory: ./tests/upgrade
working-directory: ./tests/e2e-complex/upgrade
run: bash initiate_upgrade.sh

- name: Make the upgrade and check results
working-directory: ./tests/upgrade
working-directory: ./tests/e2e-complex/upgrade
run: bash upgrade_and_check.sh
1 change: 0 additions & 1 deletion cmd/cheqd-noded/cmd/debug_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func ed25519RandomCmd() *cobra.Command {

keyInfo := struct {
PubKeyBase64 string `json:"pub_key_base_64"`
PubKeyMultibase58 string `json:"pub_key_multibase_58"`
ankurdotb marked this conversation as resolved.
Show resolved Hide resolved
PrivKeyBase64 string `json:"priv_key_base_64"`
}{
PubKeyBase64: base64.StdEncoding.EncodeToString(pubKey),
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ENTRYPOINT [ "cheqd-noded" ]
FROM base AS node

# Set runner script
COPY --chown=cheqd:cheqd docker/persistent-chains/entrypoint.sh /bin/node-start
COPY --chown=cheqd:cheqd docker/entrypoint.sh /bin/node-start
RUN chmod +x /bin/node-start

# Default entrypoint for cheqd-noded CLI usage
Expand Down
Loading