Skip to content

Commit

Permalink
refactor: remove fs and encrypted_records feature flags - Remove fs f…
Browse files Browse the repository at this point in the history
…eature flag as filesystem operations are now core functionality - Remove encrypted_records feature flag as encryption is now always enabled - Update tests and workflows to remove feature flag references - Clean up related code in client files and test modules
  • Loading branch information
dirvine committed Dec 30, 2024
1 parent cb6882d commit 81cadb9
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:

- name: Run autonomi tests
timeout-minutes: 25
run: cargo test --release --package autonomi --lib --features="full,fs"
run: cargo test --release --package autonomi --lib --features="full"

- name: Run bootstrap tests
timeout-minutes: 25
Expand All @@ -262,7 +262,7 @@ jobs:

- name: Run network tests
timeout-minutes: 25
run: cargo test --release --package ant-networking --features="open-metrics, encrypt-records"
run: cargo test --release --package ant-networking --features="open-metrics"

- name: Run protocol tests
timeout-minutes: 25
Expand Down
41 changes: 0 additions & 41 deletions ant-bootstrap/tests/cli_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ use ant_bootstrap::{BootstrapCacheConfig, PeersArgs};
use ant_logging::LogBuilder;
use anyhow::Result;
use libp2p::Multiaddr;
use std::net::{IpAddr, Ipv4Addr};
use tempfile::TempDir;
use wiremock::{
matchers::{method, path},
Mock, MockServer, ResponseTemplate,
};

// Use a private network IP instead of loopback for mDNS to work
const LOCAL_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(192, 168, 1, 23));

async fn setup() -> (TempDir, BootstrapCacheConfig) {
let temp_dir = TempDir::new().unwrap();
Expand Down Expand Up @@ -207,44 +204,6 @@ async fn test_test_network_peers() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

#[test]
fn test_cli_add_peer() -> Result<()> {
let temp_dir = TempDir::new()?;
let cache_path = temp_dir.path().join("cache.txt");

let peer_addr = format!(
"/ip4/{}/udp/8080/quic-v1/p2p/12D3KooWRBhwfeP2Y4TCx1SM6s9rUoHhR5STiGwxBhgFRcw3UERE",
LOCAL_IP
);

// ... rest of the test ...
Ok(())
}

#[test]
fn test_cli_list_peers() -> Result<()> {
let temp_dir = TempDir::new()?;
let cache_path = temp_dir.path().join("cache.txt");

let peer_addr = format!(
"/ip4/{}/udp/8080/quic-v1/p2p/12D3KooWRBhwfeP2Y4TCx1SM6s9rUoHhR5STiGwxBhgFRcw3UERE\n",
LOCAL_IP
);

// ... rest of the test ...
Ok(())
}

#[test]
fn test_cli_remove_peer() -> Result<()> {
let temp_dir = TempDir::new()?;
let cache_path = temp_dir.path().join("cache.txt");

let peer_addr = format!(
"/ip4/{}/udp/8080/quic-v1/p2p/12D3KooWRBhwfeP2Y4TCx1SM6s9rUoHhR5STiGwxBhgFRcw3UERE",
LOCAL_IP
);

// ... rest of the test ...
Ok(())
}
3 changes: 1 addition & 2 deletions ant-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ant-build-info = { path = "../ant-build-info", version = "0.1.21" }
ant-logging = { path = "../ant-logging", version = "0.2.42" }
ant-protocol = { path = "../ant-protocol", version = "0.3.1" }
autonomi = { path = "../autonomi", version = "0.3.1", features = [
"fs",
"vault",
"registers",
"loud",
Expand Down Expand Up @@ -60,7 +59,7 @@ tracing = { version = "~0.1.26" }
walkdir = "2.5.0"

[dev-dependencies]
autonomi = { path = "../autonomi", version = "0.3.1", features = ["fs"]}
autonomi = { path = "../autonomi", version = "0.3.1" }
criterion = "0.5.1"
eyre = "0.6.8"
rand = { version = "~0.8.5", features = ["small_rng"] }
Expand Down
18 changes: 14 additions & 4 deletions autonomi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ required-features = ["full"]
default = ["vault"]
external-signer = ["ant-evm/external-signer"]
extension-module = ["pyo3/extension-module"]
fs = ["tokio/fs"]
full = ["vault", "fs"]
full = ["vault"]
local = ["ant-networking/local", "ant-evm/local"]
test = ["local"]
loud = []
Expand Down Expand Up @@ -71,7 +70,18 @@ dirs-next = "2.0.0"
regex = "1.10.3"

[dev-dependencies]
alloy = { version = "0.7.3", default-features = false, features = ["contract", "json-rpc", "network", "node-bindings", "provider-http", "reqwest-rustls-tls", "rpc-client", "rpc-types", "signer-local", "std"] }
alloy = { version = "0.7.3", default-features = false, features = [
"contract",
"json-rpc",
"network",
"node-bindings",
"provider-http",
"reqwest-rustls-tls",
"rpc-client",
"rpc-types",
"signer-local",
"std",
] }
ant-logging = { path = "../ant-logging", version = "0.2.42" }
eyre = "0.6.5"
sha2 = "0.10.6"
Expand All @@ -80,7 +90,7 @@ sha2 = "0.10.6"
test-utils = { path = "../test-utils" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
portpicker = "0.1"
tokio = { version = "1.0", features = ["full", "test-util"] }
tokio = { version = "1.0", features = ["full", "test-util", "fs"] }
serial_test = "2.0.0"
lazy_static = "1.4.0"

Expand Down
6 changes: 0 additions & 6 deletions autonomi/src/client/files/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#[cfg(feature = "fs")]
use std::path::{Path, PathBuf};

pub mod archive;
pub mod archive_public;
#[cfg(feature = "fs")]
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
pub mod fs;
#[cfg(feature = "fs")]
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
pub mod fs_public;

#[cfg(feature = "fs")]
pub(crate) fn get_relative_file_path_from_abs_file_and_folder_path(
abs_file_pah: &Path,
abs_folder_path: &Path,
Expand Down
3 changes: 1 addition & 2 deletions autonomi/tests/client_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

use ant_evm::EvmWallet;
use ant_logging::LogBuilder;
use autonomi::{Client, ClientConfig};
use autonomi::Client;
use test_utils::evm::get_funded_wallet;

#[tokio::test]
Expand Down
4 changes: 1 addition & 3 deletions autonomi/tests/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

#![cfg(feature = "fs")]

use ant_logging::LogBuilder;
use anyhow::Result;
use autonomi::Client;
Expand All @@ -20,7 +18,7 @@ use tokio::time::sleep;
use walkdir::WalkDir;

// With a local evm network, and local network, run:
// EVM_NETWORK=local cargo test --features="fs,local" --package autonomi --test file
// EVM_NETWORK=local cargo test --features="local" --package autonomi --test file
#[tokio::test]
async fn dir_upload_download() -> Result<()> {
let _log_appender_guard =
Expand Down
15 changes: 0 additions & 15 deletions autonomi/tests/put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,5 @@
// KIND, either express or implied. Please review the Licences for the specific language governing
// permissions and limitations relating to use of the SAFE Network Software.

use ant_logging::LogBuilder;
use autonomi::Client;
use anyhow::Result;
use test_utils::{evm::get_funded_wallet, gen_random_data};

#[tokio::test]
async fn test_put() -> Result<()> {
let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("put", false);

let client = Client::init_with_config(Default::default()).await?;
let wallet = get_funded_wallet();
let data = gen_random_data(1024 * 1024 * 10);

let addr = client.data_put_public(data.clone(), wallet.into()).await?;

Ok(())
}

0 comments on commit 81cadb9

Please sign in to comment.