Skip to content

Commit e7b800a

Browse files
Emily Giurleop
Emily Giurleo
authored andcommitted
Fix FLE tests (#2118)
1 parent 1a79bda commit e7b800a

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

spec/mongo/client_encryption_spec.rb

+16-10
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
it_behaves_like 'it creates a data key'
269269
end
270270

271-
context 'with invalid endpoint' do
271+
context 'with https' do
272272
let(:options) do
273273
{
274274
master_key: {
@@ -279,20 +279,26 @@
279279
}
280280
end
281281

282-
let(:expected_message) do
283-
# RUBY-2129: This error message could be more specific and inform the user
284-
# that there is a problem with their KMS endpoint
285-
if BSON::Environment.jruby?
286-
/getservbyname.* failed/
287-
else
288-
/SocketError/
289-
end
282+
it_behaves_like 'it creates a data key'
283+
end
284+
285+
context 'with invalid endpoint' do
286+
let(:options) do
287+
{
288+
master_key: {
289+
key: aws_arn,
290+
region: aws_region,
291+
endpoint: "invalid-nonsense-endpoint.com"
292+
}
293+
}
290294
end
291295

292296
it 'raises an exception' do
297+
# RUBY-2129: This error message could be more specific and inform the user
298+
# that there is a problem with their KMS endpoint
293299
expect do
294300
data_key_id
295-
end.to raise_error(Mongo::Error::KmsError, expected_message)
301+
end.to raise_error(Mongo::Error::KmsError, /SocketError/)
296302
end
297303
end
298304

spec/mongo/crypt/data_key_context_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
end
189189

190190
context 'with valid endpoint' do
191-
let(:options) { { master_key: { region: 'us-east-2', key: 'arn', endpoint: 'endpoint/to/kms' } } }
191+
let(:options) { { master_key: { region: 'us-east-2', key: 'arn', endpoint: 'kms.us-east-2.amazonaws.com:443' } } }
192192

193193
it 'does not raise an exception' do
194194
expect do

0 commit comments

Comments
 (0)