Skip to content

Commit

Permalink
move iot verifier tests to single file
Browse files Browse the repository at this point in the history
- remove `#[allow(dead_code)]`
  • Loading branch information
michaeldjeffrey committed May 3, 2024
1 parent 8fa762a commit 2995b36
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub struct MockFileSinkReceiver {
pub receiver: tokio::sync::mpsc::Receiver<SinkMessage>,
}

#[allow(dead_code)]
impl MockFileSinkReceiver {
pub async fn receive(&mut self) -> Option<Vec<u8>> {
match timeout(seconds(2), self.receiver.recv()).await {
Expand Down Expand Up @@ -142,7 +141,6 @@ fn seconds(s: u64) -> std::time::Duration {
std::time::Duration::from_secs(s)
}

#[allow(dead_code)]
pub fn create_valid_beacon_report(
pubkey: &str,
received_timestamp: DateTime<Utc>,
Expand All @@ -165,7 +163,6 @@ pub fn create_valid_beacon_report(
)
}

#[allow(dead_code)]
pub fn create_valid_witness_report(
pubkey: &str,
received_timestamp: DateTime<Utc>,
Expand All @@ -186,7 +183,6 @@ pub fn create_valid_witness_report(
)
}

#[allow(dead_code)]
pub fn beacon_report_to_ingest_report(
report: IotBeaconReport,
received_timestamp: DateTime<Utc>,
Expand All @@ -197,7 +193,6 @@ pub fn beacon_report_to_ingest_report(
}
}

#[allow(dead_code)]
pub fn witness_report_to_ingest_report(
report: IotWitnessReport,
received_timestamp: DateTime<Utc>,
Expand All @@ -208,7 +203,6 @@ pub fn witness_report_to_ingest_report(
}
}

#[allow(dead_code)]
pub async fn inject_beacon_report(
pool: PgPool,
beacon: IotBeaconIngestReport,
Expand Down Expand Up @@ -237,7 +231,6 @@ pub async fn inject_beacon_report(
Ok(())
}

#[allow(dead_code)]
pub async fn inject_invalid_beacon_report(
pool: PgPool,
beacon: IotBeaconIngestReport,
Expand Down Expand Up @@ -266,7 +259,6 @@ pub async fn inject_invalid_beacon_report(
Ok(())
}

#[allow(dead_code)]
pub async fn inject_witness_report(
pool: PgPool,
witness: IotWitnessIngestReport,
Expand Down Expand Up @@ -295,7 +287,6 @@ pub async fn inject_witness_report(
Ok(())
}

#[allow(dead_code)]
pub async fn inject_entropy_report(pool: PgPool, ts: DateTime<Utc>) -> anyhow::Result<()> {
let data = REMOTE_ENTROPY.to_vec();
let id = hash(&data).as_bytes().to_vec();
Expand All @@ -305,7 +296,6 @@ pub async fn inject_entropy_report(pool: PgPool, ts: DateTime<Utc>) -> anyhow::R
Ok(())
}

#[allow(dead_code)]
pub async fn inject_last_beacon(
txn: &mut Transaction<'_, Postgres>,
gateway: PublicKeyBinary,
Expand All @@ -314,7 +304,6 @@ pub async fn inject_last_beacon(
LastBeaconReciprocity::update_last_timestamp(&mut *txn, &gateway, ts).await
}

#[allow(dead_code)]
pub async fn inject_last_witness(
txn: &mut Transaction<'_, Postgres>,
gateway: PublicKeyBinary,
Expand All @@ -323,7 +312,6 @@ pub async fn inject_last_witness(
LastWitness::update_last_timestamp(&mut *txn, &gateway, ts).await
}

#[allow(dead_code)]
pub fn valid_gateway() -> GatewayInfo {
GatewayInfo {
address: PublicKeyBinary::from_str(BEACONER1).unwrap(),
Expand All @@ -332,7 +320,6 @@ pub fn valid_gateway() -> GatewayInfo {
}
}

#[allow(dead_code)]
pub fn valid_gateway_stream() -> Vec<GatewayInfo> {
vec![
GatewayInfo {
Expand Down Expand Up @@ -413,7 +400,6 @@ pub fn valid_gateway_stream() -> Vec<GatewayInfo> {
]
}

#[allow(dead_code)]
pub fn valid_region_params() -> RegionParamsInfo {
let region_params =
beacon::RegionParams::from_bytes(ProtoRegion::Eu868.into(), 60, EU868_PARAMS, 0)
Expand Down
7 changes: 7 additions & 0 deletions iot_verifier/tests/integrations/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod common;

mod purger_tests;
mod rewarder_operations;
mod rewarder_oracles;
mod rewarder_poc_dc;
mod runner_tests;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod common;
use crate::common;
use chrono::{Duration as ChronoDuration, TimeZone, Utc};
use helium_crypto::PublicKeyBinary;
use helium_proto::services::poc_lora::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod common;
use crate::common::MockFileSinkReceiver;
use crate::common::{self, MockFileSinkReceiver};
use chrono::{Duration as ChronoDuration, Utc};
use helium_proto::services::poc_lora::OperationalReward;
use iot_verifier::{reward_share, rewarder};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod common;
use crate::common::MockFileSinkReceiver;
use crate::common::{self, MockFileSinkReceiver};
use chrono::{Duration as ChronoDuration, Utc};
use helium_proto::services::poc_lora::UnallocatedReward;
use iot_verifier::{reward_share, rewarder};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod common;
use crate::common::MockFileSinkReceiver;
use crate::common::{self, MockFileSinkReceiver};
use chrono::{DateTime, Duration as ChronoDuration, Utc};
use helium_crypto::PublicKeyBinary;
use helium_proto::services::poc_lora::{GatewayReward, UnallocatedReward, UnallocatedRewardType};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod common;
use crate::common::{self, MockFileSinkReceiver};
use async_trait::async_trait;
use chrono::{DateTime, Duration as ChronoDuration, TimeZone, Utc};
use common::MockFileSinkReceiver;
use denylist::DenyList;
use futures_util::{stream, StreamExt as FuturesStreamExt};
use helium_crypto::PublicKeyBinary;
Expand Down

0 comments on commit 2995b36

Please sign in to comment.