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

Fix clippy #803

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 0 additions & 6 deletions boost_manager/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ use file_store::file_sink::{FileSinkClient, Message as SinkMessage};
use helium_proto::BoostedHexInfoV1 as BoostedHexInfoProto;
use helium_proto::BoostedHexUpdateV1 as BoostedHexUpdateProto;
use helium_proto::Message;
use mobile_config::boosted_hex_info::BoostedHexInfo;
use tokio::{sync::mpsc::error::TryRecvError, time::timeout};

#[derive(Debug, Clone)]
pub struct MockHexBoostingClient {
pub boosted_hexes: Vec<BoostedHexInfo>,
}

pub struct MockFileSinkReceiver {
pub receiver: tokio::sync::mpsc::Receiver<SinkMessage>,
}
Expand Down
7 changes: 6 additions & 1 deletion boost_manager/tests/watcher_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod common;
use crate::common::{MockFileSinkReceiver, MockHexBoostingClient};
use crate::common::MockFileSinkReceiver;
use async_trait::async_trait;
use boost_manager::watcher::{self, Watcher};
use chrono::{DateTime, Duration as ChronoDuration, Duration, Utc};
Expand All @@ -16,6 +16,11 @@ use std::{num::NonZeroU32, str::FromStr};
const BOOST_HEX_PUBKEY: &str = "J9JiLTpjaShxL8eMvUs8txVw6TZ36E38SiJ89NxnMbLU";
const BOOST_CONFIG_PUBKEY: &str = "BZM1QTud72B2cpTW7PhEnFmRX7ZWzvY7DpPpNJJuDrWG";

#[derive(Debug, Clone)]
pub struct MockHexBoostingClient {
pub boosted_hexes: Vec<BoostedHexInfo>,
}

impl MockHexBoostingClient {
fn new(boosted_hexes: Vec<BoostedHexInfo>) -> Self {
Self { boosted_hexes }
Expand Down
13 changes: 0 additions & 13 deletions mobile_verifier/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,10 @@ use helium_proto::{
},
Message,
};
use mobile_config::boosted_hex_info::BoostedHexInfo;
use mobile_verifier::boosting_oracles::{Assignment, BoostedHexAssignments, HexAssignments};
use std::collections::HashMap;
use tokio::{sync::mpsc::error::TryRecvError, time::timeout};

pub type ValidSpMap = HashMap<String, String>;

#[derive(Debug, Clone)]
pub struct MockCarrierServiceClient {
pub valid_sps: ValidSpMap,
}

#[derive(Debug, Clone)]
pub struct MockHexBoostingClient {
pub boosted_hexes: Vec<BoostedHexInfo>,
}

pub struct MockFileSinkReceiver {
pub receiver: tokio::sync::mpsc::Receiver<SinkMessage>,
}
Expand Down
7 changes: 6 additions & 1 deletion mobile_verifier/tests/hex_boosting.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod common;
use crate::common::{MockFileSinkReceiver, MockHexBoostingClient};
use crate::common::MockFileSinkReceiver;
use async_trait::async_trait;
use chrono::{DateTime, Duration as ChronoDuration, Duration, Utc};
use file_store::{
Expand Down Expand Up @@ -39,6 +39,11 @@ const CARRIER_HOTSPOT_KEY: &str = "11hd7HoicRgBPjBGcqcT2Y9hRQovdZeff5eKFMbCSuDYQ
const BOOST_HEX_PUBKEY: &str = "J9JiLTpjaShxL8eMvUs8txVw6TZ36E38SiJ89NxnMbLU";
const BOOST_CONFIG_PUBKEY: &str = "BZM1QTud72B2cpTW7PhEnFmRX7ZWzvY7DpPpNJJuDrWG";

#[derive(Debug, Clone)]
pub struct MockHexBoostingClient {
pub boosted_hexes: Vec<BoostedHexInfo>,
}

impl MockHexBoostingClient {
fn new(boosted_hexes: Vec<BoostedHexInfo>) -> Self {
Self { boosted_hexes }
Expand Down
17 changes: 6 additions & 11 deletions mobile_verifier/tests/rewarder_poc_dc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod common;
use crate::common::{MockFileSinkReceiver, MockHexBoostingClient};
use crate::common::MockFileSinkReceiver;
use async_trait::async_trait;
use chrono::{DateTime, Duration as ChronoDuration, Utc};
use file_store::{
Expand All @@ -20,7 +20,6 @@ use mobile_verifier::{
cell_type::CellType,
coverage::{set_oracle_boosting_assignments, CoverageObject, UnassignedHex},
data_session,
geofence::GeofenceValidator,
heartbeats::{HbType, Heartbeat, ValidatedHeartbeat},
reward_shares, rewarder, speedtests,
};
Expand All @@ -34,6 +33,11 @@ const HOTSPOT_2: &str = "11uJHS2YaEWJqgqC7yza9uvSmpv5FWoMQXiP8WbxBGgNUmifUJf";
const HOTSPOT_3: &str = "112E7TxoNHV46M6tiPA8N1MkeMeQxc9ztb4JQLXBVAAUfq1kJLoF";
const PAYER_1: &str = "11eX55faMbqZB7jzN4p67m6w7ScPMH6ubnvCjCPLh72J49PaJEL";

#[derive(Debug, Clone)]
pub struct MockHexBoostingClient {
pub boosted_hexes: Vec<BoostedHexInfo>,
}

impl MockHexBoostingClient {
fn new(boosted_hexes: Vec<BoostedHexInfo>) -> Self {
Self { boosted_hexes }
Expand All @@ -56,15 +60,6 @@ impl HexBoostingInfoResolver for MockHexBoostingClient {
}
}

#[derive(Clone)]
struct MockGeofence;

impl GeofenceValidator<hextree::Cell> for MockGeofence {
fn in_valid_region(&self, _cell: &hextree::Cell) -> bool {
true
}
}

#[sqlx::test]
async fn test_poc_and_dc_rewards(pool: PgPool) -> anyhow::Result<()> {
let (mobile_rewards_client, mut mobile_rewards) = common::create_file_sink();
Expand Down
9 changes: 7 additions & 2 deletions mobile_verifier/tests/rewarder_sp_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use rust_decimal::prelude::*;
use rust_decimal_macros::dec;
use sqlx::{PgPool, Postgres, Transaction};

use common::MockCarrierServiceClient;
use common::ValidSpMap;
use mobile_config::client::{carrier_service_client::CarrierServiceVerifier, ClientError};
use mobile_verifier::{data_session, reward_shares, rewarder};

Expand All @@ -26,6 +24,13 @@ const PAYER_1: &str = "11uJHS2YaEWJqgqC7yza9uvSmpv5FWoMQXiP8WbxBGgNUmifUJf";
const PAYER_2: &str = "11sctWiP9r5wDJVuDe1Th4XSL2vaawaLLSQF8f8iokAoMAJHxqp";
const SP_1: &str = "Helium Mobile";

pub type ValidSpMap = HashMap<String, String>;

#[derive(Debug, Clone)]
pub struct MockCarrierServiceClient {
pub valid_sps: ValidSpMap,
}

impl MockCarrierServiceClient {
fn new(valid_sps: ValidSpMap) -> Self {
Self { valid_sps }
Expand Down
Loading