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

Node Manager: A Few Minor UX Enhancements #1651

Merged
merged 6 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
345 changes: 174 additions & 171 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,179 +160,182 @@ jobs:
- shell: bash
run: cargo test --lib --package sn-node-manager

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
#
# 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
# 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):')"
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sn_node_manager/src/add_services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub async fn add_node(
local: options.local,
log_dir_path: service_log_dir_path.clone(),
number: node_number,
reward_balance: None,
rpc_socket_addr,
peer_id: None,
pid: None,
Expand Down
3 changes: 3 additions & 0 deletions sn_node_manager/src/add_services/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use sn_service_management::error::Result as ServiceControlResult;
use sn_service_management::{
DaemonServiceData, FaucetServiceData, NodeRegistry, NodeServiceData, ServiceStatus,
};
use sn_transfers::NanoTokens;
use std::{
ffi::OsString,
net::{IpAddr, Ipv4Addr, SocketAddr},
Expand Down Expand Up @@ -207,6 +208,7 @@ async fn add_genesis_node_should_return_an_error_if_there_is_already_a_genesis_n
number: 1,
pid: None,
peer_id: None,
reward_balance: Some(NanoTokens::zero()),
rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081),
status: ServiceStatus::Added,
safenode_path: PathBuf::from("/var/safenode-manager/services/safenode1/safenode"),
Expand Down Expand Up @@ -785,6 +787,7 @@ async fn add_new_node_should_add_another_service() -> Result<()> {
number: 1,
pid: None,
peer_id: None,
reward_balance: Some(NanoTokens::zero()),
rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081),
safenode_path: PathBuf::from("/var/safenode-manager/services/safenode1/safenode"),
service_name: "safenode1".to_string(),
Expand Down
Loading
Loading