Skip to content

Commit

Permalink
feat: replace safe release type with autonomi
Browse files Browse the repository at this point in the history
The `ReleaseType::Safe` variant is replaced with `ReleaseType::Autonomi`.

The integration tests here won't work until the first stable release of the binary. They can be
fixed for the next publish.
  • Loading branch information
jacderida committed Oct 20, 2024
1 parent 454da70 commit 68c8971
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ use tokio::fs::File;
use tokio::io::AsyncWriteExt;
use zip::ZipArchive;

const GITHUB_API_URL: &str = "https://api.github.com";
const AUTONOMI_S3_BASE_URL: &str = "https://autonomi-cli.s3.eu-west-2.amazonaws.com";
const FAUCET_S3_BASE_URL: &str = "https://sn-faucet.s3.eu-west-2.amazonaws.com";
const GITHUB_API_URL: &str = "https://api.github.com";
const NAT_DETECTION_S3_BASE_URL: &str = "https://nat-detection.s3.eu-west-2.amazonaws.com";
const NODE_LAUNCHPAD_S3_BASE_URL: &str = "https://node-launchpad.s3.eu-west-2.amazonaws.com";
const SAFE_S3_BASE_URL: &str = "https://sn-cli.s3.eu-west-2.amazonaws.com";
const SAFENODE_S3_BASE_URL: &str = "https://sn-node.s3.eu-west-2.amazonaws.com";
const SAFENODE_MANAGER_S3_BASE_URL: &str = "https://sn-node-manager.s3.eu-west-2.amazonaws.com";
const SAFENODE_RPC_CLIENT_S3_BASE_URL: &str =
"https://sn-node-rpc-client.s3.eu-west-2.amazonaws.com";
const SAFENODE_S3_BASE_URL: &str = "https://sn-node.s3.eu-west-2.amazonaws.com";
const SN_AUDITOR_S3_BASE_URL: &str = "https://sn-auditor.s3.eu-west-2.amazonaws.com";
const WINSW_URL: &str = "https://sn-node-manager.s3.eu-west-2.amazonaws.com/WinSW-x64.exe";

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum ReleaseType {
Autonomi,
Faucet,
NatDetection,
NodeLaunchpad,
Safe,
Safenode,
SafenodeManager,
SafenodeManagerDaemon,
Expand All @@ -55,10 +55,10 @@ impl fmt::Display for ReleaseType {
f,
"{}",
match self {
ReleaseType::Autonomi => "autonomi",
ReleaseType::Faucet => "faucet",
ReleaseType::NatDetection => "nat-detection",
ReleaseType::NodeLaunchpad => "node-launchpad",
ReleaseType::Safe => "safe",
ReleaseType::Safenode => "safenode",
ReleaseType::SafenodeManager => "safenode-manager",
ReleaseType::SafenodeManagerDaemon => "safenodemand",
Expand All @@ -72,10 +72,10 @@ impl fmt::Display for ReleaseType {
lazy_static! {
static ref RELEASE_TYPE_CRATE_NAME_MAP: HashMap<ReleaseType, &'static str> = {
let mut m = HashMap::new();
m.insert(ReleaseType::Autonomi, "autonomi");
m.insert(ReleaseType::Faucet, "sn_faucet");
m.insert(ReleaseType::NatDetection, "nat-detection");
m.insert(ReleaseType::NodeLaunchpad, "node-launchpad");
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");
Expand Down Expand Up @@ -158,7 +158,7 @@ impl dyn SafeReleaseRepoActions {
nat_detection_base_url: NAT_DETECTION_S3_BASE_URL.to_string(),
faucet_base_url: FAUCET_S3_BASE_URL.to_string(),
node_launchpad_base_url: NODE_LAUNCHPAD_S3_BASE_URL.to_string(),
safe_base_url: SAFE_S3_BASE_URL.to_string(),
autonomi_base_url: AUTONOMI_S3_BASE_URL.to_string(),
safenode_base_url: SAFENODE_S3_BASE_URL.to_string(),
safenode_manager_base_url: SAFENODE_MANAGER_S3_BASE_URL.to_string(),
safenode_rpc_client_base_url: SAFENODE_RPC_CLIENT_S3_BASE_URL.to_string(),
Expand All @@ -172,7 +172,7 @@ pub struct SafeReleaseRepository {
pub faucet_base_url: String,
pub nat_detection_base_url: String,
pub node_launchpad_base_url: String,
pub safe_base_url: String,
pub autonomi_base_url: String,
pub safenode_base_url: String,
pub safenode_manager_base_url: String,
pub safenode_rpc_client_base_url: String,
Expand All @@ -185,7 +185,7 @@ impl SafeReleaseRepository {
ReleaseType::Faucet => self.faucet_base_url.clone(),
ReleaseType::NatDetection => self.nat_detection_base_url.clone(),
ReleaseType::NodeLaunchpad => self.node_launchpad_base_url.clone(),
ReleaseType::Safe => self.safe_base_url.clone(),
ReleaseType::Autonomi => self.autonomi_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(),
Expand Down
48 changes: 24 additions & 24 deletions tests/test_download_from_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use sn_releases::{ArchiveType, Platform, ReleaseType, SafeReleaseRepoActions};
const FAUCET_VERSION: &str = "0.1.98";
const NAT_DETECTION_VERSION: &str = "0.1.0";
const NODE_LAUNCHPAD_VERSION: &str = "0.1.0";
const SAFE_VERSION: &str = "0.94.0";
const AUTONOMI_VERSION: &str = "1.0.0";
const SAFENODE_VERSION: &str = "0.93.7";
const SAFENODE_MANAGER_VERSION: &str = "0.1.8";
const SAFENODE_MANAGERD_VERSION: &str = "0.4.1";
Expand Down Expand Up @@ -56,7 +56,7 @@ async fn download_and_extract(
ReleaseType::Faucet => "faucet",
ReleaseType::NatDetection => "nat-detection",
ReleaseType::NodeLaunchpad => "node-launchpad",
ReleaseType::Safe => "safe",
ReleaseType::Autonomi => "autonomi",
ReleaseType::Safenode => "safenode",
ReleaseType::SafenodeManager => "safenode-manager",
ReleaseType::SafenodeManagerDaemon => "safenodemand",
Expand All @@ -75,79 +75,79 @@ async fn download_and_extract(
}

///
/// Safe Tests
/// Autonomi Tests
///
#[tokio::test]
async fn should_download_and_extract_safe_for_linux_musl() {
async fn should_download_and_extract_autonomi_for_linux_musl() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::LinuxMusl,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_linux_musl_aarch64() {
async fn should_download_and_extract_autonomi_for_linux_musl_aarch64() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::LinuxMuslAarch64,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_linux_musl_arm() {
async fn should_download_and_extract_autonomi_for_linux_musl_arm() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::LinuxMuslArm,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_linux_musl_arm_v7() {
async fn should_download_and_extract_autonomi_for_linux_musl_arm_v7() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::LinuxMuslArmV7,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_macos() {
async fn should_download_and_extract_autonomi_for_macos() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::MacOs,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_macos_aarch64() {
async fn should_download_and_extract_autonomi_for_macos_aarch64() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::MacOsAarch64,
&ArchiveType::TarGz,
)
.await;
}

#[tokio::test]
async fn should_download_and_extract_safe_for_windows() {
async fn should_download_and_extract_autonomi_for_windows() {
download_and_extract(
&ReleaseType::Safe,
SAFE_VERSION,
&ReleaseType::Autonomi,
AUTONOMI_VERSION,
&Platform::Windows,
&ArchiveType::Zip,
)
Expand Down

0 comments on commit 68c8971

Please sign in to comment.