Skip to content

Commit 6caba34

Browse files
committed
Test all backends with an empty store_id
Most VSS users don't actually care about the `store_id` - they have some data which they want to store for themselves (keyed on the authenticated user id) and that's it. There's not really any reason to force them to specify a `store_id`, the empty string is just as valid as any other. In the previous commit we allowed empty `store_id`s in the postgres backend, here we add tests (randomly) with empty `store_id`s in the standardized backend tests.
1 parent 9bb171d commit 6caba34

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

rust/api/src/kv_store_tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,12 @@ pub struct TestContext<'a> {
552552
impl<'a> TestContext<'a> {
553553
/// Creates a new [`TestContext`] with the given [`KvStore`] implementation.
554554
pub fn new(kv_store: &'a dyn KvStore) -> Self {
555-
let store_id: String = (0..7).map(|_| thread_rng().sample(Alphanumeric) as char).collect();
556-
TestContext { kv_store, user_token: "userToken".to_string(), store_id }
555+
let store_id_len = thread_rng().gen_range(0..6);
556+
let store_id: String =
557+
(0..store_id_len).map(|_| thread_rng().sample(Alphanumeric) as char).collect();
558+
let user_token: String =
559+
(0..7).map(|_| thread_rng().sample(Alphanumeric) as char).collect();
560+
TestContext { kv_store, user_token, store_id }
557561
}
558562

559563
async fn get_object(&self, key: &str) -> Result<KeyValue, VssError> {

0 commit comments

Comments
 (0)