Skip to content

Commit

Permalink
Fix url and connector naming
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <[email protected]>
  • Loading branch information
Licenser committed Jul 24, 2024
1 parent 927874e commit cc6f887
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes
* gbq connector naming is now `gbq_writer` as it is documented
* fix gbq connector url missing `/`

## [0.13.0-rc.29]

### New features
Expand Down
2 changes: 1 addition & 1 deletion tremor-connectors-gcp/src/gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
//!
//! | name | description | default |
//! |---------------------|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
//! | `url` | The HTTP(s) endpoint to which the requests will be made | `"https://storage.googleapis.com/upload/storage/v1"` |
//! | `url` | The HTTP(s) endpoint to which the requests will be made | `"https://storage.googleapis.com/upload/storage/v1/"` |
//! | `bucket` | The optional bucket to stream events into if not overwritten by event metadata `$gcs_streamer.bucket` | |
//! | `mode` | The mode of operation for this connector. See [Modes of operation](#modes-of-operation). | |
//! | `connect_timeout` | The timeout for the connection (in nanoseconds) | `10_000_000_000` (10 seconds) |
Expand Down
9 changes: 6 additions & 3 deletions tremor-connectors-gcp/src/gcs/resumable_upload_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<TClient: HttpClientTrait, TBackoffStrategy: BackoffStrategy + Send + Sync>
bucket: &str,
) -> anyhow::Result<bool> {
let mut response = retriable_request(&self.backoff_strategy, &mut self.client, || {
let url = format!("{url}/b/{bucket}");
let url = url.join("b/")?.join(bucket)?.to_string();
Ok(Request::builder()
.method(Method::GET)
.uri(url)
Expand Down Expand Up @@ -457,7 +457,7 @@ mod tests {
async fn can_bucket_exists() -> anyhow::Result<()> {
let client = MockHttpClient {
handle_request: Box::new(|req| {
assert_eq!(req.uri().path(), "/b/snot");
assert_eq!(req.uri().path(), "/upload/storage/v1/b/snot");
assert_eq!(req.method(), Method::GET);

let response = Response::builder()
Expand All @@ -476,7 +476,10 @@ mod tests {
},
};
let bucket_exists = api_client
.bucket_exists(&Url::parse("http://example.com")?, "snot")
.bucket_exists(
&Url::parse("https://storage.googleapis.com/upload/storage/v1/")?,
"snot",
)
.await?;
assert!(bucket_exists);
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion tremor-connectors-gcp/src/gcs/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(super) struct Config {
#[allow(clippy::unwrap_used)]
fn default_endpoint() -> Url<HttpsDefaults> {
// ALLOW: this URL is hardcoded, so the only reason for parse failing would be if it was changed
Url::parse("https://storage.googleapis.com/upload/storage/v1").unwrap()
Url::parse("https://storage.googleapis.com/upload/storage/v1/").unwrap()
}

fn default_connect_timeout() -> u64 {
Expand Down

0 comments on commit cc6f887

Please sign in to comment.