-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
197 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: 'Run e2e tests' | ||
description: 'Activate python venv and run e2e tests' | ||
|
||
inputs: | ||
env: | ||
description: 'Test environment' | ||
required: true | ||
keyword: | ||
description: 'Run tests by keyword (-k)' | ||
required: false | ||
default: 'test_' | ||
markers: | ||
description: 'Run tests by markers (-m)' | ||
required: false | ||
default: 'not active_flow and not passive_flow and not probability' | ||
mc_epoch: | ||
description: 'MC epoch to test (committee tests)' | ||
required: false | ||
log_level: | ||
description: 'Log CLI level' | ||
required: false | ||
default: 'info' | ||
init_timestamp: | ||
description: 'MC initialization timestamp in seconds' | ||
required: false | ||
default: '0' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Run tests | ||
shell: bash | ||
run: | | ||
if [ -n "${{ inputs.mc_epoch }}" ]; then | ||
mc_epoch_switch="--mc-epoch ${{ inputs.mc_epoch }}" | ||
fi | ||
cd e2e-tests | ||
source venv/bin/activate | ||
pytest --blockchain substrate \ | ||
--env ${{ inputs.env }} \ | ||
--stack ${{ inputs.env }} \ | ||
--log-cli-level ${{ inputs.log_level }} \ | ||
-k "${{ inputs.keyword }}" \ | ||
-m "${{ inputs.markers }}" \ | ||
--init-timestamp ${{ inputs.init_timestamp }} \ | ||
$mc_epoch_switch \ | ||
--decrypt \ | ||
--json-report \ | ||
--json-report-summary \ | ||
--junitxml=junit_report.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: 'Wait for epoch' | ||
description: 'Wait for epoch in local environment' | ||
|
||
inputs: | ||
epoch: | ||
description: 'Expected epoch' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Wait for epoch | ||
shell: bash | ||
run: | | ||
epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch) | ||
while [ $epoch -lt ${{ inputs.epoch }} ]; do \ | ||
echo "Epoch: $epoch" && \ | ||
sleep 10 && \ | ||
epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch); \ | ||
done | ||
echo "Epoch: $epoch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: Run e2e tests against local environment | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
description: "Node Image" | ||
required: true | ||
tag: | ||
description: "PC Artifact Tag" | ||
required: true | ||
|
||
jobs: | ||
run-e2e-tests: | ||
runs-on: ubuntu-latest | ||
env: | ||
TEST_ENVIRONMENT: demo | ||
steps: | ||
- name: Checkout e2e tests | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: input-output-hk/sidechains-tests | ||
token: ${{ secrets.ACTIONS_PAT }} | ||
ref: ETCM-8119/run-tests-on-ci | ||
path: e2e-tests | ||
|
||
- name: Setup python and dependencies | ||
run: | | ||
cd e2e-tests | ||
sudo apt update | ||
sudo apt install -y software-properties-common | ||
sudo add-apt-repository ppa:deadsnakes/ppa | ||
sudo apt update | ||
sudo apt install -y python3.10 python3.10-venv python3.10-dev | ||
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 | ||
curl -L --silent https://github.com/getsops/sops/releases/download/v3.7.3/sops_3.7.3_amd64.deb > sops.deb && sudo dpkg -i sops.deb && rm sops.deb | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
- name: Wait for the PC node 1 to start | ||
run: | | ||
while ! docker exec cardano-node-1 [ -e /shared/cardano.ready ]; do sleep 1; done | ||
echo "Cardano network is ready! Waiting for Partner Chain first node to start..." | ||
INIT_TIMESTAMP=$(docker exec cardano-node-1 cat /shared/cardano.start) | ||
echo "INIT_TIMESTAMP=$INIT_TIMESTAMP" >> $GITHUB_ENV | ||
while ! docker exec partner-chains-node-1 [ -e /shared/partner-chains-node-1.ready ]; do \ | ||
epoch=$(docker exec cardano-node-1 cardano-cli query tip --testnet-magic 42 | jq -r .epoch) && \ | ||
echo "Epoch: $epoch" && \ | ||
sleep 10; \ | ||
done | ||
- name: Run smoke tests | ||
uses: ./partner-chains-master/.github/run-e2e-tests | ||
with: | ||
env: ${{ env.TEST_ENVIRONMENT }} | ||
keyword: "test_get_status or test_get_params" | ||
|
||
- name: Wait for epoch 3 | ||
uses: ./partner-chains-masters/.github/wait-for-epoch | ||
with: | ||
epoch: 3 | ||
|
||
- name: Run registration tests | ||
uses: ./partner-chains-master/.github/run-tests | ||
with: | ||
env: ${{ env.TEST_ENVIRONMENT }} | ||
keyword: "test_register_candidate or test_deregister_candidate or test_add_permissioned_candidate or test_remove_permissioned_candidate" | ||
init_timestamp: ${{ env.INIT_TIMESTAMP }} | ||
|
||
- name: Wait for epoch 4 | ||
uses: ./partner-chains-master/.github/wait-for-epoch | ||
with: | ||
epoch: 4 | ||
|
||
- name: Run registration tests | ||
uses: ./partner-chains-master/.github/run-tests | ||
with: | ||
env: ${{ env.TEST_ENVIRONMENT }} | ||
keyword: "test_register_candidate or test_deregister_candidate or test_add_permissioned_candidate or test_remove_permissioned_candidate" | ||
init_timestamp: ${{ env.INIT_TIMESTAMP }} | ||
|
||
- name: Wait for epoch 5 | ||
uses: ./partner-chains-master/.github/wait-for-epoch | ||
with: | ||
epoch: 5 | ||
|
||
- name: Run all tests | ||
uses: ./partner-chains-master/.github/run-tests | ||
with: | ||
env: ${{ env.TEST_ENVIRONMENT }} | ||
mc_epoch: 4 | ||
init_timestamp: ${{ env.INIT_TIMESTAMP }} | ||
|
||
- name: Wait for epoch 6 | ||
uses: ./partner-chains-master/.github/wait-for-epoch | ||
with: | ||
epoch: 6 | ||
|
||
- name: Run all tests | ||
uses: ./partner-chains-master/.github/run-tests | ||
with: | ||
env: ${{ env.TEST_ENVIRONMENT }} | ||
mc_epoch: 5 | ||
init_timestamp: ${{ env.INIT_TIMESTAMP }} | ||
|
||
- name: Wait for epoch 7 | ||
uses: ./partner-chains-master/.github/wait-for-epoch | ||
with: | ||
epoch: 7 | ||
|
||
- name: Run all tests | ||
uses: ./partner-chains-master/.github/run-tests | ||
with: | ||
env: ${{ env.TEST_ENVIRONMENT }} | ||
mc_epoch: 6 | ||
init_timestamp: ${{ env.INIT_TIMESTAMP }} |