Skip to content

Commit

Permalink
fix(ci): re enable churn test
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin committed Oct 11, 2024
1 parent 67549f4 commit b532cc4
Showing 1 changed file with 116 additions and 117 deletions.
233 changes: 116 additions & 117 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -556,135 +556,134 @@ jobs:
# log_file_prefix: safe_test_logs_token_distribution
# platform: ${{ matrix.os }}

# churn:
# if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
# name: Network churning tests
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# include:
# - os: ubuntu-latest
# node_data_path: /home/runner/.local/share/safe/node
# safe_path: /home/runner/.local/share/safe
# - os: windows-latest
# node_data_path: C:\\Users\\runneradmin\\AppData\\Roaming\\safe\\node
# safe_path: C:\\Users\\runneradmin\\AppData\\Roaming\\safe
# - os: macos-latest
# node_data_path: /Users/runner/Library/Application Support/safe/node
# safe_path: /Users/runner/Library/Application Support/safe
# steps:
# - uses: actions/checkout@v4

# - uses: dtolnay/rust-toolchain@stable
churn:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
name: Network churning tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
node_data_path: /home/runner/.local/share/safe/node
safe_path: /home/runner/.local/share/safe
- os: windows-latest
node_data_path: C:\\Users\\runneradmin\\AppData\\Roaming\\safe\\node
safe_path: C:\\Users\\runneradmin\\AppData\\Roaming\\safe
- os: macos-latest
node_data_path: /Users/runner/Library/Application Support/safe/node
safe_path: /Users/runner/Library/Application Support/safe
steps:
- uses: actions/checkout@v4

# - uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable

# - name: Build binaries
# run: cargo build --release --features local --bin safenode
# timeout-minutes: 30
- uses: Swatinem/rust-cache@v2

# - name: Build faucet binaries
# run: cargo build --release --features="local,gifting" --bin faucet
# timeout-minutes: 30
- name: Build binaries
run: cargo build --release --features local --bin safenode
timeout-minutes: 30

# - name: Build churn tests
# run: cargo test --release -p sn_node --features=local --test data_with_churn --no-run
# env:
# # only set the target dir for windows to bypass the linker issue.
# # happens if we build the node manager via testnet action
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 30
- name: Build churn tests
run: cargo test --release -p sn_node --features=local --test data_with_churn --no-run
env:
# only set the target dir for windows to bypass the linker issue.
# happens if we build the node manager via testnet action
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 30

# - name: Start a local network
# uses: maidsafe/sn-local-testnet-action@main
# with:
# action: start
# interval: 2000
# node-path: target/release/safenode
# faucet-path: target/release/faucet
# platform: ${{ matrix.os }}
# build: true
- name: Start a local network
uses: maidsafe/sn-local-testnet-action@evm-dev
with:
action: start
enable-evm-testnet: true
node-path: target/release/safenode
platform: ${{ matrix.os }}
build: true

# - name: Check SAFE_PEERS was set
# shell: bash
# run: |
# if [[ -z "$SAFE_PEERS" ]]; then
# echo "The SAFE_PEERS variable has not been set"
# exit 1
# else
# echo "SAFE_PEERS has been set to $SAFE_PEERS"
# fi
- name: Check if SAFE_PEERS and EVM_NETWORK are set
shell: bash
run: |
if [[ -z "$SAFE_PEERS" ]]; then
echo "The SAFE_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 "SAFE_PEERS has been set to $SAFE_PEERS"
echo "EVM_NETWORK has been set to $EVM_NETWORK"
fi
# - name: Chunks data integrity during nodes churn
# run: cargo test --release -p sn_node --features="local" --test data_with_churn -- --nocapture
# env:
# TEST_DURATION_MINS: 5
# TEST_TOTAL_CHURN_CYCLES: 15
# SN_LOG: "all"
# CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
# timeout-minutes: 30
- name: Chunks data integrity during nodes churn
run: cargo test --release -p sn_node --features=local --test data_with_churn -- --nocapture
env:
TEST_DURATION_MINS: 5
TEST_TOTAL_CHURN_CYCLES: 15
SN_LOG: "all"
CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }}
timeout-minutes: 30

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

# - name: Verify 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 "Restart $restart_count nodes"
# peer_removed=$(rg "PeerRemovedFromRoutingTable" "${{ matrix.node_data_path }}" -c --stats | \
# rg "(\d+) matches" | rg "\d+" -o)
# echo "PeerRemovedFromRoutingTable $peer_removed times"
# if [ $peer_removed -lt $restart_count ]; then
# echo "PeerRemovedFromRoutingTable times of: $peer_removed is less than the restart count of: $restart_count"
# exit 1
# fi
# node_count=$(ls "${{ matrix.node_data_path }}" | wc -l)
# echo "Node dir count is $node_count"
- name: Verify 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 "Restart $restart_count nodes"
peer_removed=$(rg "PeerRemovedFromRoutingTable" "${{ matrix.node_data_path }}" -c --stats | \
rg "(\d+) matches" | rg "\d+" -o)
echo "PeerRemovedFromRoutingTable $peer_removed times"
if [ $peer_removed -lt $restart_count ]; then
echo "PeerRemovedFromRoutingTable times of: $peer_removed is less than the restart count of: $restart_count"
exit 1
fi
node_count=$(ls "${{ matrix.node_data_path }}" | wc -l)
echo "Node dir count is $node_count"
# # TODO: reenable this once the testnet dir creation is tidied up to avoid a large count here
# # if [ $restart_count -lt $node_count ]; then
# # echo "Restart count of: $restart_count is less than the node count of: $node_count"
# # exit 1
# # fi
# TODO: reenable this once the testnet dir creation is tidied up to avoid a large count here
# if [ $restart_count -lt $node_count ]; then
# echo "Restart count of: $restart_count is less than the node count of: $node_count"
# exit 1
# fi

# - name: Verify data replication 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 replication
# # TODO: make this use an env var, or relate to testnet size
# run: |
# fetching_attempt_count=$(rg "FetchingKeysForReplication" "${{ matrix.node_data_path }}" -c --stats | \
# rg "(\d+) matches" | rg "\d+" -o)
# echo "Carried out $fetching_attempt_count fetching attempts"
# node_count=$(ls "${{ matrix.node_data_path }}" | wc -l)
# if [ $fetching_attempt_count -lt $node_count ]; then
# echo "Replication fetching attempts of: $fetching_attempt_count is less than the node count of: $node_count"
# exit 1
# fi
- name: Verify data replication 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 replication
# TODO: make this use an env var, or relate to testnet size
run: |
fetching_attempt_count=$(rg "FetchingKeysForReplication" "${{ matrix.node_data_path }}" -c --stats | \
rg "(\d+) matches" | rg "\d+" -o)
echo "Carried out $fetching_attempt_count fetching attempts"
node_count=$(ls "${{ matrix.node_data_path }}" | wc -l)
if [ $fetching_attempt_count -lt $node_count ]; then
echo "Replication fetching attempts of: $fetching_attempt_count is less than the node count of: $node_count"
exit 1
fi
# # Only error out after uploading the logs
# - name: Don't log raw data
# if: matrix.os != 'windows-latest' # causes error
# shell: bash
# timeout-minutes: 10
# run: |
# if ! rg '^' "${{ matrix.safe_path }}"/*/*/logs | awk 'length($0) > 15000 { print; exit 1 }'
# then
# echo "We are logging an extremely large data"
# exit 1
# fi
# Only error out after uploading the logs
- name: Don't log raw data
if: matrix.os != 'windows-latest' # causes error
shell: bash
timeout-minutes: 10
run: |
if ! rg '^' "${{ matrix.safe_path }}"/*/*/logs | awk 'length($0) > 15000 { print; exit 1 }'
then
echo "We are logging an extremely large data"
exit 1
fi
verify_data_location_routing_table:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
Expand Down

0 comments on commit b532cc4

Please sign in to comment.