Skip to content

Commit

Permalink
GODRIVER-2378 resync badQueries and types CSFLE tests (#906)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinAlbs committed Apr 11, 2022
1 parent 8aecd15 commit b5c26f5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
4 changes: 2 additions & 2 deletions data/client-side-encryption/badQueries.json
Expand Up @@ -1318,7 +1318,7 @@
}
},
"result": {
"errorContains": "Cannot encrypt element of type array"
"errorContains": "Cannot encrypt element of type"
}
}
]
Expand Down Expand Up @@ -1387,7 +1387,7 @@
}
},
"result": {
"errorContains": "Cannot encrypt element of type array"
"errorContains": "Cannot encrypt element of type"
}
}
]
Expand Down
14 changes: 12 additions & 2 deletions data/client-side-encryption/badQueries.yml
Expand Up @@ -476,7 +476,12 @@ tests:
filter: { }
update: { $set : { "encrypted_string": [1,2] }}
result:
errorContains: "Cannot encrypt element of type array"
# The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot encrypt element of type array because schema requires that type is one of: [ string ]"
# After it is:
# "Cannot encrypt element of type: array"
# Only check for the common prefix.
errorContains: "Cannot encrypt element of type"
- description: "an insert with encrypted field on _id errors"
clientOptions:
autoEncryptOpts:
Expand All @@ -500,7 +505,12 @@ tests:
arguments:
document: { encrypted_string: [ "123", "456"] }
result:
errorContains: "Cannot encrypt element of type array"
# The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot encrypt element of type array because schema requires that type is one of: [ string ]"
# After it is:
# "Cannot encrypt element of type: array"
# Only check for the common prefix.
errorContains: "Cannot encrypt element of type"
- description: "an insert with a Timestamp(0,0) value in the top-level fails"
clientOptions:
autoEncryptOpts:
Expand Down
12 changes: 6 additions & 6 deletions data/client-side-encryption/types.json
Expand Up @@ -504,7 +504,7 @@
}
},
"result": {
"errorContains": "Cannot use deterministic encryption for element of type: double"
"errorContains": "element of type: double"
}
}
]
Expand Down Expand Up @@ -551,7 +551,7 @@
}
},
"result": {
"errorContains": "Cannot use deterministic encryption for element of type: decimal"
"errorContains": "element of type: decimal"
}
}
]
Expand Down Expand Up @@ -883,7 +883,7 @@
}
},
"result": {
"errorContains": "Cannot use deterministic encryption for element of type: javascriptWithScope"
"errorContains": "element of type: javascriptWithScope"
}
}
]
Expand Down Expand Up @@ -928,7 +928,7 @@
}
},
"result": {
"errorContains": "Cannot use deterministic encryption for element of type: object"
"errorContains": "element of type: object"
}
}
]
Expand Down Expand Up @@ -1547,7 +1547,7 @@
}
},
"result": {
"errorContains": "Cannot use deterministic encryption for element of type: array"
"errorContains": "element of type: array"
}
}
]
Expand Down Expand Up @@ -1592,7 +1592,7 @@
}
},
"result": {
"errorContains": "Cannot use deterministic encryption for element of type: bool"
"errorContains": "element of type: bool"
}
}
]
Expand Down
42 changes: 36 additions & 6 deletions data/client-side-encryption/types.yml
Expand Up @@ -146,7 +146,12 @@ tests:
arguments:
document: &doc4 { _id: 1, encrypted_double: {"$numberDouble": "1.23"} }
result:
errorContains: "Cannot use deterministic encryption for element of type: double"
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot use deterministic encryption for element of type: double"
# After it is:
# "Cannot encrypt element of type: double"
# Only check for the common suffix.
errorContains: "element of type: double"
- description: "type=decimal"
clientOptions:
autoEncryptOpts:
Expand All @@ -159,7 +164,12 @@ tests:
arguments:
document: &doc5 { _id: 1, encrypted_decimal: {"$numberDecimal": "1.23"} }
result:
errorContains: "Cannot use deterministic encryption for element of type: decimal"
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot use deterministic encryption for element of type: decimal"
# After it is:
# "Cannot encrypt element of type: decimal"
# Only check for the common suffix.
errorContains: "element of type: decimal"
- description: "type=binData"
clientOptions:
autoEncryptOpts:
Expand Down Expand Up @@ -254,7 +264,12 @@ tests:
arguments:
document: &doc8 { _id: 1, encrypted_javascriptWithScope: {"$code": "var x = 1;", "$scope": {} } }
result:
errorContains: "Cannot use deterministic encryption for element of type: javascriptWithScope"
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot use deterministic encryption for element of type: javascriptWithScope"
# After it is:
# "Cannot encrypt element of type: javascriptWithScope"
# Only check for the common suffix.
errorContains: "element of type: javascriptWithScope"
- description: "type=object"
clientOptions:
autoEncryptOpts:
Expand All @@ -267,7 +282,12 @@ tests:
arguments:
document: &doc9 { _id: 1, encrypted_object: {} }
result:
errorContains: "Cannot use deterministic encryption for element of type: object"
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot use deterministic encryption for element of type: object"
# After it is:
# "Cannot encrypt element of type: object"
# Only check for the common suffix.
errorContains: "element of type: object"
- description: "type=timestamp"
clientOptions:
autoEncryptOpts:
Expand Down Expand Up @@ -442,7 +462,12 @@ tests:
arguments:
document: &doc17 { _id: 1, encrypted_array: [] }
result:
errorContains: "Cannot use deterministic encryption for element of type: array"
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot use deterministic encryption for element of type: array"
# After it is:
# "Cannot encrypt element of type: array"
# Only check for the common suffix.
errorContains: "element of type: array"
- description: "type=bool"
clientOptions:
autoEncryptOpts:
Expand All @@ -455,7 +480,12 @@ tests:
arguments:
document: &doc18 { _id: 1, encrypted_bool: true }
result:
errorContains: "Cannot use deterministic encryption for element of type: bool"
# DRIVERS-2272: The expected error message changed in mongocryptd 6.0. Before it was:
# "Cannot use deterministic encryption for element of type: bool"
# After it is:
# "Cannot encrypt element of type: bool"
# Only check for the common suffix.
errorContains: "element of type: bool"
- description: "type=null"
clientOptions:
autoEncryptOpts:
Expand Down

0 comments on commit b5c26f5

Please sign in to comment.