Skip to content

Commit

Permalink
test: enable data_with_churn using networkspawner
Browse files Browse the repository at this point in the history
  • Loading branch information
ermineJose committed Mar 6, 2025
1 parent 2c3ed57 commit 4494f42
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 92 deletions.
88 changes: 44 additions & 44 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -661,28 +661,40 @@ jobs:
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 30

- name: Start a local network
uses: maidsafe/ant-local-testnet-action@main
with:
action: start
enable-evm-testnet: true
node-path: target/release/antnode
platform: ${{ matrix.os }}
build: true

- name: Check if ANT_PEERS and EVM_NETWORK are set
shell: bash
run: |
if [[ -z "$ANT_PEERS" ]]; then
echo "The ANT_PEERS variable has not been set"
exit 1
elif [[ -z "$EVM_NETWORK" ]]; then
echo "The EVM_NETWORK variable has not been set"
exit 1
else
echo "ANT_PEERS has been set to $ANT_PEERS"
echo "EVM_NETWORK has been set to $EVM_NETWORK"
fi
# - name: Start a local network
# uses: maidsafe/ant-local-testnet-action@main
# with:
# action: start
# enable-evm-testnet: true
# node-path: target/release/antnode
# platform: ${{ matrix.os }}
# build: true

# - name: Check if ANT_PEERS and EVM_NETWORK are set
# shell: bash
# run: |
# if [[ -z "$ANT_PEERS" ]]; then
# echo "The ANT_PEERS variable has not been set"
# exit 1
# elif [[ -z "$EVM_NETWORK" ]]; then
# echo "The EVM_NETWORK variable has not been set"
# exit 1
# else
# echo "ANT_PEERS has been set to $ANT_PEERS"
# echo "EVM_NETWORK has been set to $EVM_NETWORK"
# fi

# # Sleep for a while to allow restarted nodes can be detected by others
# - name: Sleep a while
# run: sleep 300

# - name: Stop the local network and upload logs
# if: always()
# uses: maidsafe/ant-local-testnet-action@main
# with:
# action: stop
# log_file_prefix: safe_test_logs_churn
# platform: ${{ matrix.os }}

- name: Chunks data integrity during nodes churn
run: cargo test --release -p ant-node --test data_with_churn -- --nocapture
Expand All @@ -693,35 +705,23 @@ jobs:
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 30

# Sleep for a while to allow restarted nodes can be detected by others
- name: Sleep a while
run: sleep 300

- name: Stop the local network and upload logs
if: always()
uses: maidsafe/ant-local-testnet-action@main
with:
action: stop
log_file_prefix: safe_test_logs_churn
platform: ${{ matrix.os }}

- name: Get total node count
shell: bash
timeout-minutes: 1
run: |
node_count=$(ls "${{ matrix.node_data_path }}" | wc -l)
echo "Node dir count is $node_count"
- name: Get restart of nodes using rg
shell: bash
timeout-minutes: 1
# get the counts, then the specific line, and then the digit count only
# then check we have an expected level of restarts
# TODO: make this use an env var, or relate to testnet size
run: |
restart_count=$(rg "Node is restarting in" "${{ matrix.node_data_path }}" -c --stats | \
rg "(\d+) matches" | rg "\d+" -o)
echo "Restarted $restart_count nodes"
# - name: Get restart of nodes using rg
# shell: bash
# timeout-minutes: 1
# # get the counts, then the specific line, and then the digit count only
# # then check we have an expected level of restarts
# # TODO: make this use an env var, or relate to testnet size
# run: |
# restart_count=$(rg "Node is restarting in" "${{ matrix.node_data_path }}" -c --stats | \
# rg "(\d+) matches" | rg "\d+" -o)
# echo "Restarted $restart_count nodes"

# `PeerRemovedFromRoutingTable` now only happens when a peer reported as `BadNode`.
# Otherwise kad will remove a `dropped out node` directly from RT.
Expand Down
Loading

0 comments on commit 4494f42

Please sign in to comment.