-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: enable node man integration tests
These tests are enabled again, along with some changes to the setup. Here are the important points: * The tests now run against an isolated local network and binary built during CI is supplied. * The workflow runs the e2e tests for both system-wide and user-mode services. * The test definitions are moved to a new workflow file, but it has the same conditions as the merge workflow. The reason is just because the merge workflow file is already large and difficult to navigate. * The upgrade integration tests are removed because since the service management refactor, unit tests cover the upgrade scenarios well. What we are more concerned with in the upgrade process is the logic of how different upgrade scenarios are handled. * The daemon integration tests are removed. The test that was setup was really trying to cover the scenario where peer retention was specified for restart commands, but we have agreed that the semantics of this command is wrong and that it needs to be broken down. In general, the daemon commands will correspond to the operations of the node manager, and the node manager operations should already be quite well tested. * Some documentation.
- Loading branch information
Showing
8 changed files
with
229 additions
and
631 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 |
---|---|---|
|
@@ -141,207 +141,6 @@ jobs: | |
# we do many more runs on the nightly run | ||
PROPTEST_CASES: 50 | ||
|
||
node-manager-unit-tests: | ||
name: node manager unit tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: cargo cache registry, index and build | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }} | ||
- shell: bash | ||
run: cargo test --lib --package sn-node-manager | ||
|
||
# | ||
# Temporarily disable node manager integration tests until they can be made more isolated. | ||
# | ||
# node-manager-e2e-tests: | ||
# name: node manager e2e tests | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# include: | ||
# - { os: ubuntu-latest, elevated: sudo env PATH="$PATH" } | ||
# - { os: macos-latest, elevated: sudo } | ||
# - { os: windows-latest } | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Install Rust | ||
# uses: dtolnay/rust-toolchain@stable | ||
# - uses: Swatinem/rust-cache@v2 | ||
# | ||
# - shell: bash | ||
# if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
# run: | | ||
# ${{ matrix.elevated }} rustup default stable | ||
# ${{ matrix.elevated }} cargo test --package sn-node-manager --release --test e2e -- --nocapture | ||
# | ||
# # Powershell step runs as admin by default. | ||
# - name: run integration test in powershell | ||
# if: matrix.os == 'windows-latest' | ||
# shell: pwsh | ||
# run: | | ||
# curl -L -o WinSW.exe $env:WINSW_URL | ||
# | ||
# New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\bin" | ||
# Move-Item -Path WinSW.exe -Destination "$env:GITHUB_WORKSPACE\bin" | ||
# $env:PATH += ";$env:GITHUB_WORKSPACE\bin" | ||
# | ||
# cargo test --release --package sn-node-manager --test e2e -- --nocapture | ||
|
||
# Each upgrade test needs its own VM, otherwise they will interfere with each other. | ||
# node-manager-upgrade-tests: | ||
# name: node manager upgrade tests | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# include: | ||
# - { | ||
# os: ubuntu-latest, | ||
# elevated: sudo env PATH="$PATH", | ||
# test: upgrade_to_latest_version, | ||
# } | ||
# - { | ||
# os: ubuntu-latest, | ||
# elevated: sudo env PATH="$PATH", | ||
# test: force_upgrade_when_two_binaries_have_the_same_version, | ||
# } | ||
# - { | ||
# os: ubuntu-latest, | ||
# elevated: sudo env PATH="$PATH", | ||
# test: force_downgrade_to_a_previous_version, | ||
# } | ||
# - { | ||
# os: ubuntu-latest, | ||
# elevated: sudo env PATH="$PATH", | ||
# test: upgrade_from_older_version_to_specific_version, | ||
# } | ||
# - { | ||
# os: macos-latest, | ||
# elevated: sudo, | ||
# test: upgrade_to_latest_version, | ||
# } | ||
# - { | ||
# os: macos-latest, | ||
# elevated: sudo, | ||
# test: force_upgrade_when_two_binaries_have_the_same_version, | ||
# } | ||
# - { | ||
# os: macos-latest, | ||
# elevated: sudo, | ||
# test: force_downgrade_to_a_previous_version, | ||
# } | ||
# - { | ||
# os: macos-latest, | ||
# elevated: sudo, | ||
# test: upgrade_from_older_version_to_specific_version, | ||
# } | ||
# - { os: windows-latest, test: upgrade_to_latest_version } | ||
# - { | ||
# os: windows-latest, | ||
# test: force_upgrade_when_two_binaries_have_the_same_version, | ||
# } | ||
# - { os: windows-latest, test: force_downgrade_to_a_previous_version } | ||
# - { | ||
# os: windows-latest, | ||
# test: upgrade_from_older_version_to_specific_version, | ||
# } | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Install Rust | ||
# uses: dtolnay/rust-toolchain@stable | ||
# - uses: Swatinem/rust-cache@v2 | ||
# | ||
# - shell: bash | ||
# if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
# run: | | ||
# ${{ matrix.elevated }} rustup default stable | ||
# ${{ matrix.elevated }} cargo test --package sn-node-manager --release \ | ||
# --test upgrades ${{ matrix.test }} -- --nocapture | ||
# | ||
# # Powershell step runs as admin by default. | ||
# - name: run integration test in powershell | ||
# if: matrix.os == 'windows-latest' | ||
# shell: pwsh | ||
# run: | | ||
# curl -L -o WinSW.exe $env:WINSW_URL | ||
# | ||
# New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\bin" | ||
# Move-Item -Path WinSW.exe -Destination "$env:GITHUB_WORKSPACE\bin" | ||
# $env:PATH += ";$env:GITHUB_WORKSPACE\bin" | ||
# | ||
# cargo test --package sn-node-manager --release ` | ||
# --test upgrades ${{ matrix.test }} -- --nocapture | ||
# | ||
# # Each daemon test needs its own VM, otherwise they will interfere with each other. | ||
# node-manager-daemon-tests: | ||
# name: node manager daemon tests | ||
# runs-on: ${{ matrix.os }} | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# include: | ||
# - { | ||
# os: ubuntu-latest, | ||
# elevated: sudo env PATH="$PATH", | ||
# test: restart_node, | ||
# } | ||
# # todo: enable once url/version has been implemented for Daemon subcmd. | ||
# # - { | ||
# # os: macos-latest, | ||
# # elevated: sudo, | ||
# # test: restart_node, | ||
# # } | ||
# # - { | ||
# # os: windows-latest, | ||
# # test: restart_node, | ||
# # } | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# | ||
# - name: Install Rust | ||
# uses: dtolnay/rust-toolchain@stable | ||
# - uses: Swatinem/rust-cache@v2 | ||
# | ||
# - name: run integration test | ||
# shell: bash | ||
# if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
# run: | | ||
# ${{ matrix.elevated }} rustup default stable | ||
# ${{ matrix.elevated }} cargo test --package sn-node-manager --release \ | ||
# --test daemon ${{ matrix.test }} -- --nocapture | ||
# | ||
# # Powershell step runs as admin by default. | ||
# - name: run integration test in powershell | ||
# if: matrix.os == 'windows-latest' | ||
# shell: pwsh | ||
# run: | | ||
# curl -L -o WinSW.exe $env:WINSW_URL | ||
# | ||
# New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\bin" | ||
# Move-Item -Path WinSW.exe -Destination "$env:GITHUB_WORKSPACE\bin" | ||
# $env:PATH += ";$env:GITHUB_WORKSPACE\bin" | ||
# | ||
# cargo test --package sn-node-manager --release ` | ||
# --test daemon ${{ matrix.test }} -- --nocapture | ||
|
||
e2e: | ||
if: "!startsWith(github.event.head_commit.message, 'chore(release):')" | ||
name: E2E tests | ||
|
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,156 @@ | ||
name: Node Manager Tests | ||
|
||
on: | ||
merge_group: | ||
branches: [main, alpha*, beta*, rc*] | ||
pull_request: | ||
branches: ["*"] | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 # bookkeeping for incremental builds has overhead, not useful in CI. | ||
WINSW_URL: https://github.com/winsw/winsw/releases/download/v3.0.0-alpha.11/WinSW-x64.exe | ||
|
||
jobs: | ||
node-manager-unit-tests: | ||
name: node manager unit tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: cargo cache registry, index and build | ||
uses: actions/[email protected] | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
target | ||
key: ${{ runner.os }}-cargo-cache-${{ hashFiles('**/Cargo.lock') }} | ||
- shell: bash | ||
run: cargo test --lib --package sn-node-manager | ||
|
||
node-manager-user-mode-e2e-tests: | ||
name: user-mode e2e | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { os: ubuntu-latest } | ||
- { os: macos-latest } | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build binaries | ||
run: cargo build --release --bin safenode --bin faucet | ||
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: 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 | ||
- shell: bash | ||
run: | | ||
cargo test --package sn-node-manager --release --test e2e -- --nocapture | ||
- name: Stop the local network and upload logs | ||
if: always() | ||
uses: maidsafe/sn-local-testnet-action@main | ||
with: | ||
action: stop | ||
log_file_prefix: node_man_tests_user_mode | ||
platform: ${{ matrix.os }} | ||
|
||
node-manager-e2e-tests: | ||
name: system-wide e2e | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { os: ubuntu-latest, elevated: sudo -E env PATH="$PATH" } | ||
- { os: macos-latest, elevated: sudo -E } | ||
- { os: windows-latest } | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build binaries | ||
run: cargo build --release --bin safenode --bin faucet | ||
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: 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 | ||
- shell: bash | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: | | ||
${{ matrix.elevated }} rustup default stable | ||
${{ matrix.elevated }} cargo test --package sn-node-manager --release --test e2e -- --nocapture | ||
# Powershell step runs as admin by default. | ||
- name: run integration test in powershell | ||
if: matrix.os == 'windows-latest' | ||
shell: pwsh | ||
run: | | ||
curl -L -o WinSW.exe $env:WINSW_URL | ||
New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\bin" | ||
Move-Item -Path WinSW.exe -Destination "$env:GITHUB_WORKSPACE\bin" | ||
$env:PATH += ";$env:GITHUB_WORKSPACE\bin" | ||
cargo test --release --package sn-node-manager --test e2e -- --nocapture | ||
- name: Stop the local network and upload logs | ||
if: always() | ||
uses: maidsafe/sn-local-testnet-action@main | ||
with: | ||
action: stop | ||
log_file_prefix: node_man_tests_system_wide | ||
platform: ${{ matrix.os }} |
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
Oops, something went wrong.