Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ jobs:
- name: Run unit and integration tests
env:
DATABASE_URL: "postgres://postgres:postgres@postgres:5432/postgres"
AWSLOCAL_ENDPOINT: "http://localstack:4566"
run: cargo test -p ${{ matrix.package }} -- --include-ignored

build-release:
Expand Down
8 changes: 7 additions & 1 deletion aws_local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ use aws_sdk_s3::{Client, Endpoint, Region};
use chrono::Utc;
use file_store::traits::MsgBytes;
use file_store::{file_sink, file_upload, FileStore, FileType, Settings};
use std::env;
use std::path::Path;
use std::{str::FromStr, sync::Arc};
use tempfile::TempDir;
use tokio::sync::Mutex;
use tonic::transport::Uri;
use uuid::Uuid;

pub const AWSLOCAL_DEFAULT_ENDPOINT: &str = "http://localstack:4566";
pub const AWSLOCAL_ENDPOINT_ENV: &str = "AWSLOCAL_ENDPOINT";
pub const AWSLOCAL_DEFAULT_ENDPOINT: &str = "http://localhost:4566";

pub fn aws_local_default_endpoint() -> String {
env::var(AWSLOCAL_ENDPOINT_ENV).unwrap_or_else(|_| AWSLOCAL_DEFAULT_ENDPOINT.to_string())
}

pub fn gen_bucket_name() -> String {
format!("mvr-{}-{}", Uuid::new_v4(), Utc::now().timestamp_millis())
Expand Down
3 changes: 1 addition & 2 deletions mobile_verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ solana = { path = "../solana" }
task-manager = { path = "../task_manager" }

[dev-dependencies]
proptest = "1.5.0"
aws-local = { path = "../aws_local" }
proptest = "1.5.0"
tempfile = "3"

6 changes: 4 additions & 2 deletions mobile_verifier/tests/integrations/boosting_oracles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ pub async fn create_data_set_downloader(
) -> (DataSetDownloaderDaemon, PathBuf, String) {
let bucket_name = gen_bucket_name();

let awsl = AwsLocal::new(AWSLOCAL_DEFAULT_ENDPOINT, &bucket_name).await;
let endpoint = aws_local_default_endpoint();
let awsl = AwsLocal::new(endpoint.as_str(), &bucket_name).await;

for file_path in file_paths {
awsl.put_file_to_aws(&file_path).await.unwrap();
Expand Down Expand Up @@ -209,7 +210,8 @@ async fn test_dataset_downloader(pool: PgPool) {
assert!(hex_assignment_file_exist(&pool, "landtype.1722895200000.gz").await);
assert!(hex_assignment_file_exist(&pool, "service_provider_override.1739404800000.gz").await);

let awsl = AwsLocal::new(AWSLOCAL_DEFAULT_ENDPOINT, &bucket_name).await;
let endpoint = aws_local_default_endpoint();
let awsl = AwsLocal::new(endpoint.as_str(), &bucket_name).await;
awsl.put_file_to_aws(
&PathBuf::from_str("./tests/integrations/fixtures/footfall.1732895200000.gz").unwrap(),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use aws_local::{gen_bucket_name, AwsLocal, AWSLOCAL_DEFAULT_ENDPOINT};
use aws_local::{gen_bucket_name, AwsLocal};
use chrono::DateTime;
use file_store::{
file_info_poller::LookbackBehavior,
Expand Down Expand Up @@ -63,7 +63,8 @@ pub async fn put_subscriber_reports_to_aws(
#[sqlx::test]
async fn test_process_map_act_ingest_report_file(pool: PgPool) {
let bucket_name = gen_bucket_name();
let awsl = AwsLocal::new(AWSLOCAL_DEFAULT_ENDPOINT, &bucket_name).await;
let endpoint = aws_local_default_endpoint();
let awsl = AwsLocal::new(endpoint.as_str(), &bucket_name).await;

let (stream_receiver, stream_server) = file_source::Continuous::prost_source()
.state(pool.clone())
Expand Down