Skip to content

Commit

Permalink
fix(config): Default to spool V1 when spool entry is missing (#3883)
Browse files Browse the repository at this point in the history
The default of `EnvelopeSpoolVersion` was correctly set to V1, but
`EnvelopeSpool::default()` returned the wrong value.
  • Loading branch information
jjbayer authored Aug 1, 2024
1 parent 890e1d1 commit 3cfb9f0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ impl Default for EnvelopeSpool {
disk_batch_size: spool_envelopes_stack_disk_batch_size(),
max_batches: spool_envelopes_stack_max_batches(),
max_envelope_delay_secs: spool_envelopes_max_envelope_delay_secs(),
version: EnvelopeSpoolVersion::V2,
version: EnvelopeSpoolVersion::default(),
}
}
}
Expand Down Expand Up @@ -2594,4 +2594,16 @@ cache:
fn test_emit_outcomes_invalid() {
assert!(serde_json::from_str::<EmitOutcomes>("asdf").is_err());
}

#[test]
fn test_spool_defaults_to_v1() {
let config: ConfigValues = serde_json::from_str("{}").unwrap();
assert!(matches!(
config.spool.envelopes.version,
EnvelopeSpoolVersion::V1
));

let config = Config::from_json_value(serde_json::json!({})).unwrap();
assert!(!config.spool_v2());
}
}

0 comments on commit 3cfb9f0

Please sign in to comment.