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

feat: support safenodemand releases #12

Merged
merged 1 commit into from
Mar 19, 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
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub enum ReleaseType {
Safe,
Safenode,
SafenodeManager,
SafenodeManagerDaemon,
SafenodeRpcClient,
}

Expand All @@ -50,6 +51,7 @@ impl fmt::Display for ReleaseType {
ReleaseType::Safe => "safe",
ReleaseType::Safenode => "safenode",
ReleaseType::SafenodeManager => "safenode-manager",
ReleaseType::SafenodeManagerDaemon => "safenodemand",
ReleaseType::SafenodeRpcClient => "safenode_rpc_client",
}
)
Expand All @@ -63,6 +65,7 @@ lazy_static! {
m.insert(ReleaseType::Safe, "sn_cli");
m.insert(ReleaseType::Safenode, "sn_node");
m.insert(ReleaseType::SafenodeManager, "sn-node-manager");
m.insert(ReleaseType::SafenodeManagerDaemon, "sn-node-manager");
m.insert(ReleaseType::SafenodeRpcClient, "sn_node_rpc_client");
m
};
Expand Down Expand Up @@ -159,6 +162,7 @@ impl SafeReleaseRepository {
ReleaseType::Safe => self.safe_base_url.clone(),
ReleaseType::Safenode => self.safenode_base_url.clone(),
ReleaseType::SafenodeManager => self.safenode_manager_base_url.clone(),
ReleaseType::SafenodeManagerDaemon => self.safenode_manager_base_url.clone(),
ReleaseType::SafenodeRpcClient => self.safenode_rpc_client_base_url.clone(),
}
}
Expand Down
71 changes: 71 additions & 0 deletions tests/test_download_from_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const FAUCET_VERSION: &str = "0.1.98";
const SAFE_VERSION: &str = "0.83.51";
const SAFENODE_VERSION: &str = "0.93.7";
const SAFENODE_MANAGER_VERSION: &str = "0.1.8";
const SAFENODE_MANAGERD_VERSION: &str = "0.4.1";
const SAFENODE_RPC_CLIENT_VERSION: &str = "0.1.40";

async fn download_and_extract(
Expand Down Expand Up @@ -53,6 +54,7 @@ async fn download_and_extract(
ReleaseType::Safe => "safe",
ReleaseType::Safenode => "safenode",
ReleaseType::SafenodeManager => "safenode-manager",
ReleaseType::SafenodeManagerDaemon => "safenodemand",
ReleaseType::SafenodeRpcClient => "safenode_rpc_client",
};
let expected_binary_name = if *platform == Platform::Windows {
Expand Down Expand Up @@ -441,3 +443,72 @@ async fn should_download_and_extract_faucet_for_windows() {
)
.await;
}

///
/// Node Manager Daemon Tests
///
#[tokio::test]
async fn should_download_and_extract_safenodemand_for_linux_musl() {
download_and_extract(
&ReleaseType::SafenodeManagerDaemon,
SAFENODE_MANAGERD_VERSION,
&Platform::LinuxMusl,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safenodemand_for_linux_musl_aarch64() {
download_and_extract(
&ReleaseType::SafenodeManagerDaemon,
SAFENODE_MANAGERD_VERSION,
&Platform::LinuxMuslAarch64,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safenodemand_for_linux_musl_arm() {
download_and_extract(
&ReleaseType::SafenodeManagerDaemon,
SAFENODE_MANAGERD_VERSION,
&Platform::LinuxMuslArm,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safenodemand_for_linux_musl_arm_v7() {
download_and_extract(
&ReleaseType::SafenodeManagerDaemon,
SAFENODE_MANAGERD_VERSION,
&Platform::LinuxMuslArmV7,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safenodemand_for_macos() {
download_and_extract(
&ReleaseType::SafenodeManagerDaemon,
SAFENODE_MANAGERD_VERSION,
&Platform::MacOs,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safenodemand_for_windows() {
download_and_extract(
&ReleaseType::SafenodeManagerDaemon,
SAFENODE_MANAGERD_VERSION,
&Platform::Windows,
&ArchiveType::Zip,
)
.await;
}
11 changes: 11 additions & 0 deletions tests/test_get_latest_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,14 @@ async fn should_get_latest_version_of_safenode_manager() {
.unwrap();
assert!(valid_semver_format(&version));
}

#[tokio::test]
async fn should_get_latest_version_of_safenodemand() {
let release_type = ReleaseType::SafenodeManagerDaemon;
let release_repo = <dyn SafeReleaseRepositoryInterface>::default_config();
let version = release_repo
.get_latest_version(&release_type)
.await
.unwrap();
assert!(valid_semver_format(&version));
}
Loading