Skip to content

Commit d1f4e71

Browse files
update unified test
1 parent 57ce8c5 commit d1f4e71

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

src/test/spec/json/client-side-encryption/unified/client-bulkWrite-qe.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
22
"description": "client bulkWrite with queryable encryption",
3-
"schemaVersion": "1.23",
3+
"schemaVersion": "1.25",
44
"runOnRequirements": [
55
{
66
"minServerVersion": "8.0",
77
"serverless": "forbid",
8-
"csfle": true
8+
"csfle": {
9+
"minLibmongocryptVersion": "1.10.0"
10+
}
911
}
1012
],
1113
"createEntities": [

src/test/spec/unified_runner/test_file.rs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,20 @@ pub(crate) struct RunOnRequirement {
8686
server_parameters: Option<Document>,
8787
serverless: Option<Serverless>,
8888
auth: Option<bool>,
89-
csfle: Option<bool>,
89+
csfle: Option<Csfle>,
9090
auth_mechanism: Option<AuthMechanism>,
9191
}
9292

93+
#[derive(Debug, Deserialize)]
94+
#[serde(untagged)]
95+
enum Csfle {
96+
Bool(bool),
97+
#[serde(rename_all = "camelCase")]
98+
Version {
99+
min_libmongocrypt_version: String,
100+
},
101+
}
102+
93103
#[derive(Clone, Copy, Debug, Deserialize, PartialEq)]
94104
#[serde(rename_all = "lowercase", deny_unknown_fields)]
95105
pub(crate) enum Topology {
@@ -147,8 +157,32 @@ impl RunOnRequirement {
147157
return Err("requires auth".to_string());
148158
}
149159
}
150-
if self.csfle == Some(true) && !cfg!(feature = "in-use-encryption") {
151-
return Err("requires csfle but in-use-encryption feature not enabled".to_string());
160+
if let Some(ref csfle) = self.csfle {
161+
match csfle {
162+
Csfle::Bool(true) | Csfle::Version { .. }
163+
if cfg!(not(feature = "in-use-encryption")) =>
164+
{
165+
return Err(
166+
"requires csfle but in-use-encryption feature not enabled".to_string()
167+
);
168+
}
169+
#[cfg(feature = "in-use-encryption")]
170+
Csfle::Version {
171+
min_libmongocrypt_version,
172+
} => {
173+
let requirement =
174+
semver::VersionReq::parse(&format!(">={min_libmongocrypt_version}"))
175+
.unwrap();
176+
let version = semver::Version::parse(mongocrypt::version()).unwrap();
177+
if !requirement.matches(&version) {
178+
return Err(format!(
179+
"requires at least libmongocrypt version {min_libmongocrypt_version} \
180+
but using version {version}"
181+
));
182+
}
183+
}
184+
_ => {}
185+
}
152186
}
153187
if let Some(ref auth_mechanism) = self.auth_mechanism {
154188
let actual_mechanism = get_client_options()

src/test/spec/unified_runner/test_runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const SKIPPED_OPERATIONS: &[&str] = &[
6767
];
6868

6969
static MIN_SPEC_VERSION: Version = Version::new(1, 0, 0);
70-
static MAX_SPEC_VERSION: Version = Version::new(1, 23, 0);
70+
static MAX_SPEC_VERSION: Version = Version::new(1, 25, 0);
7171

7272
pub(crate) type EntityMap = HashMap<String, Entity>;
7373

0 commit comments

Comments
 (0)