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
2 changes: 0 additions & 2 deletions icechunk/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,6 @@ pub enum GcsStaticCredentials {
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[serde(tag = "gcs_bearer_credential_type")]
#[serde(rename_all = "snake_case")]
pub struct GcsBearerCredential {
pub bearer: String,
pub expires_after: Option<DateTime<Utc>>,
Expand Down
23 changes: 23 additions & 0 deletions icechunk/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,8 @@ mod tests {

use std::{collections::HashSet, fs::File, io::Write, path::PathBuf};

use crate::config::{GcsBearerCredential, GcsStaticCredentials};

use super::*;
use icechunk_macros::tokio_test;
use proptest::prelude::*;
Expand All @@ -971,6 +973,27 @@ mod tests {
assert!(s.root_is_clean().await.unwrap());
}

#[tokio_test]
/// Regression test: we can deserialize a GCS credential with token
async fn test_gcs_session_serialization() {
let storage = new_gcs_storage(
"bucket".to_string(),
Some("prefix".to_string()),
Some(GcsCredentials::Static(GcsStaticCredentials::BearerToken(
GcsBearerCredential {
bearer: "the token".to_string(),
expires_after: None,
},
))),
None,
)
.await
.unwrap();
let bytes = rmp_serde::to_vec(&storage).unwrap();
let dese: Result<Arc<dyn Storage>, _> = rmp_serde::from_slice(&bytes);
assert!(dese.is_ok())
}

proptest! {
#![proptest_config(ProptestConfig {
cases: 999, .. ProptestConfig::default()
Expand Down