diff --git a/quickwit/quickwit-storage/src/opendal_storage/google_cloud_storage.rs b/quickwit/quickwit-storage/src/opendal_storage/google_cloud_storage.rs index fc022fd1e08..9f174f0a744 100644 --- a/quickwit/quickwit-storage/src/opendal_storage/google_cloud_storage.rs +++ b/quickwit/quickwit-storage/src/opendal_storage/google_cloud_storage.rs @@ -57,7 +57,6 @@ pub mod test_config_helpers { /// URL of the local GCP emulator. pub const LOCAL_GCP_EMULATOR_ENDPOINT: &str = "http://127.0.0.1:4443"; - /// Creates a storage connecting to a local emulated google cloud storage. pub fn new_emulated_google_cloud_storage( uri: &Uri, @@ -67,7 +66,9 @@ pub mod test_config_helpers { let cfg = opendal::services::Gcs::default() .bucket(&bucket) .root(&root.to_string_lossy()) - .endpoint(LOCAL_GCP_EMULATOR_ENDPOINT); + .endpoint(LOCAL_GCP_EMULATOR_ENDPOINT) + .allow_anonymous() // Disable authentication for fake GCS server + .disable_vm_metadata(); // Disable GCE metadata server requests let store = OpendalStorage::new_google_cloud_storage(uri.clone(), cfg)?; Ok(store) } diff --git a/quickwit/quickwit-storage/tests/google_cloud_storage.rs b/quickwit/quickwit-storage/tests/google_cloud_storage.rs index c87dfc6b2d3..4b916b44f4f 100644 --- a/quickwit/quickwit-storage/tests/google_cloud_storage.rs +++ b/quickwit/quickwit-storage/tests/google_cloud_storage.rs @@ -28,32 +28,11 @@ mod gcp_storage_test_suite { LOCAL_GCP_EMULATOR_ENDPOINT, new_emulated_google_cloud_storage, }; - pub async fn sign_gcs_request(req: &mut reqwest::Request) -> anyhow::Result<()> { - let signer = reqsign::google::default_signer("storage"); - - // Create http::Request and extract parts for signing - let http_req = http::Request::builder() - .method(req.method()) - .uri(req.url().as_str()) - .version(http::Version::HTTP_11) - .body(())?; - - let (mut parts, _body) = http_req.into_parts(); - - // Copy headers from reqwest request - parts.headers = req.headers().clone(); - - // Sign the request parts - signer.sign(&mut parts, None).await?; - - // Update the original request with signed headers - let headers = req.headers_mut(); - headers.clear(); - for (key, value) in &parts.headers { - headers.insert(key.clone(), value.clone()); - } - - Ok(()) + pub fn sign_gcs_request(req: &mut reqwest::Request) { + req.headers_mut().insert( + reqwest::header::AUTHORIZATION, + reqwest::header::HeaderValue::from_str("Bearer dummy").unwrap(), + ); } async fn create_gcs_bucket(bucket_name: &str) -> anyhow::Result<()> { @@ -67,7 +46,7 @@ mod gcp_storage_test_suite { .header(reqwest::header::CONTENT_TYPE, "application/json") .build()?; - sign_gcs_request(&mut request).await?; + sign_gcs_request(&mut request); let response = client.execute(request).await?;