mongo 2.18.0.beta1 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/mongo/bulk_write.rb +8 -2
  4. data/lib/mongo/client.rb +19 -5
  5. data/lib/mongo/client_encryption.rb +86 -4
  6. data/lib/mongo/cluster.rb +6 -4
  7. data/lib/mongo/collection/view/aggregation.rb +3 -0
  8. data/lib/mongo/collection/view/change_stream.rb +9 -0
  9. data/lib/mongo/collection/view/iterable.rb +1 -0
  10. data/lib/mongo/collection/view/readable.rb +11 -3
  11. data/lib/mongo/collection.rb +9 -1
  12. data/lib/mongo/config.rb +11 -0
  13. data/lib/mongo/crypt/auto_encrypter.rb +49 -21
  14. data/lib/mongo/crypt/binding.rb +73 -48
  15. data/lib/mongo/crypt/data_key_context.rb +6 -1
  16. data/lib/mongo/crypt/encryption_io.rb +66 -0
  17. data/lib/mongo/crypt/explicit_encrypter.rb +116 -5
  18. data/lib/mongo/crypt/explicit_encryption_context.rb +3 -8
  19. data/lib/mongo/crypt/handle.rb +26 -8
  20. data/lib/mongo/crypt/kms/aws.rb +11 -3
  21. data/lib/mongo/crypt/kms/azure.rb +14 -6
  22. data/lib/mongo/crypt/kms/gcp.rb +12 -5
  23. data/lib/mongo/crypt/kms/kmip.rb +15 -9
  24. data/lib/mongo/crypt/kms/local.rb +9 -1
  25. data/lib/mongo/crypt/kms/master_key_document.rb +1 -1
  26. data/lib/mongo/crypt/rewrap_many_data_key_context.rb +46 -0
  27. data/lib/mongo/crypt/rewrap_many_data_key_result.rb +37 -0
  28. data/lib/mongo/crypt/status.rb +8 -2
  29. data/lib/mongo/crypt.rb +2 -0
  30. data/lib/mongo/database.rb +10 -27
  31. data/lib/mongo/error/missing_file_chunk.rb +8 -2
  32. data/lib/mongo/grid/stream/read.rb +6 -0
  33. data/lib/mongo/index/view.rb +1 -0
  34. data/lib/mongo/operation/create/op_msg.rb +1 -13
  35. data/lib/mongo/operation/distinct/op_msg.rb +4 -1
  36. data/lib/mongo/protocol/msg.rb +0 -16
  37. data/lib/mongo/server/connection_pool.rb +5 -4
  38. data/lib/mongo/server/monitor/connection.rb +10 -4
  39. data/lib/mongo/server/monitor.rb +4 -0
  40. data/lib/mongo/server/push_monitor.rb +4 -0
  41. data/lib/mongo/version.rb +1 -1
  42. data/lib/mongo.rb +2 -0
  43. data/spec/README.md +14 -0
  44. data/spec/integration/change_stream_spec.rb +1 -1
  45. data/spec/integration/client_construction_spec.rb +73 -7
  46. data/spec/integration/client_side_encryption/auto_encryption_command_monitoring_spec.rb +165 -164
  47. data/spec/integration/client_side_encryption/decryption_events_prose_spec.rb +158 -0
  48. data/spec/integration/client_side_encryption/explicit_queryable_encryption_spec.rb +5 -5
  49. data/spec/integration/client_side_encryption/kms_tls_options_spec.rb +50 -8
  50. data/spec/integration/client_side_encryption/unique_index_on_key_alt_names_prose_spec.rb +85 -0
  51. data/spec/integration/ocsp_verifier_spec.rb +1 -1
  52. data/spec/integration/reconnect_spec.rb +2 -0
  53. data/spec/integration/sdam_events_spec.rb +40 -0
  54. data/spec/integration/srv_monitoring_spec.rb +1 -0
  55. data/spec/integration/srv_spec.rb +1 -0
  56. data/spec/lite_spec_helper.rb +5 -4
  57. data/spec/mongo/bulk_write_spec.rb +13 -0
  58. data/spec/mongo/client_construction_spec.rb +45 -2
  59. data/spec/mongo/client_encryption_spec.rb +0 -12
  60. data/spec/mongo/client_spec.rb +1 -1
  61. data/spec/mongo/collection/view/aggregation_spec.rb +119 -0
  62. data/spec/mongo/collection/view/readable_spec.rb +630 -5
  63. data/spec/mongo/collection_spec.rb +32 -0
  64. data/spec/mongo/crypt/auto_encrypter_spec.rb +110 -0
  65. data/spec/mongo/crypt/binding/context_spec.rb +3 -35
  66. data/spec/mongo/crypt/data_key_context_spec.rb +1 -1
  67. data/spec/mongo/crypt/explicit_encryption_context_spec.rb +8 -3
  68. data/spec/mongo/crypt/handle_spec.rb +39 -3
  69. data/spec/mongo/crypt/kms/credentials_spec.rb +0 -47
  70. data/spec/mongo/index/view_spec.rb +56 -0
  71. data/spec/mongo/operation/create/op_msg_spec.rb +0 -42
  72. data/spec/mongo/server/connection_pool_spec.rb +26 -4
  73. data/spec/mongo/socket/ssl_spec.rb +3 -3
  74. data/spec/runners/crud/requirement.rb +6 -1
  75. data/spec/runners/crud/test.rb +1 -1
  76. data/spec/runners/transactions/spec.rb +2 -2
  77. data/spec/runners/transactions/test.rb +4 -20
  78. data/spec/runners/transactions.rb +2 -2
  79. data/spec/runners/unified/assertions.rb +32 -2
  80. data/spec/runners/unified/change_stream_operations.rb +3 -0
  81. data/spec/runners/unified/client_side_encryption_operations.rb +83 -0
  82. data/spec/runners/unified/crud_operations.rb +17 -2
  83. data/spec/runners/unified/ddl_operations.rb +27 -2
  84. data/spec/runners/unified/grid_fs_operations.rb +21 -0
  85. data/spec/runners/unified/test.rb +59 -1
  86. data/spec/shared/lib/mrss/docker_runner.rb +2 -0
  87. data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
  88. data/spec/shared/lib/mrss/lite_constraints.rb +10 -2
  89. data/spec/shared/shlib/set_env.sh +3 -0
  90. data/spec/solo/clean_exit_spec.rb +5 -0
  91. data/spec/spec_tests/client_side_encryption_spec.rb +1 -1
  92. data/spec/spec_tests/client_side_encryption_unified_spec.rb +16 -0
  93. data/spec/spec_tests/data/change_streams_unified/change-streams-showExpandedEvents.yml +298 -0
  94. data/spec/spec_tests/data/client_side_encryption/create-and-createIndexes.yml +58 -0
  95. data/spec/spec_tests/data/client_side_encryption/fle2-Delete.yml +1 -1
  96. data/spec/spec_tests/data/client_side_encryption/fle2-EncryptedFields-vs-jsonSchema.yml +1 -1
  97. data/spec/spec_tests/data/client_side_encryption/fle2-FindOneAndUpdate.yml +2 -2
  98. data/spec/spec_tests/data/client_side_encryption/fle2-InsertFind-Indexed.yml +1 -1
  99. data/spec/spec_tests/data/client_side_encryption/fle2-Update.yml +2 -2
  100. data/spec/spec_tests/data/client_side_encryption/unified/addKeyAltName.yml +194 -0
  101. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey-kms_providers-invalid.yml +67 -0
  102. data/spec/spec_tests/data/client_side_encryption/unified/createDataKey.yml +309 -0
  103. data/spec/spec_tests/data/client_side_encryption/unified/deleteKey.yml +159 -0
  104. data/spec/spec_tests/data/client_side_encryption/unified/getKey.yml +105 -0
  105. data/spec/spec_tests/data/client_side_encryption/unified/getKeyByAltName.yml +104 -0
  106. data/spec/spec_tests/data/client_side_encryption/unified/getKeys.yml +122 -0
  107. data/spec/spec_tests/data/client_side_encryption/unified/removeKeyAltName.yml +157 -0
  108. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-decrypt_failure.yml +69 -0
  109. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey-encrypt_failure.yml +122 -0
  110. data/spec/spec_tests/data/client_side_encryption/unified/rewrapManyDataKey.yml +432 -0
  111. data/spec/spec_tests/data/client_side_encryption/validatorAndPartialFieldExpression.yml +166 -0
  112. data/spec/spec_tests/data/command_monitoring_unified/bulkWrite.yml +68 -0
  113. data/spec/spec_tests/data/command_monitoring_unified/command.yml +50 -0
  114. data/spec/spec_tests/data/command_monitoring_unified/deleteMany.yml +79 -0
  115. data/spec/spec_tests/data/command_monitoring_unified/deleteOne.yml +79 -0
  116. data/spec/spec_tests/data/command_monitoring_unified/find.yml +254 -0
  117. data/spec/spec_tests/data/command_monitoring_unified/insertMany.yml +79 -0
  118. data/spec/spec_tests/data/command_monitoring_unified/insertOne.yml +77 -0
  119. data/spec/spec_tests/data/command_monitoring_unified/unacknowledgedBulkWrite.yml +55 -0
  120. data/spec/spec_tests/data/command_monitoring_unified/updateMany.yml +87 -0
  121. data/spec/spec_tests/data/command_monitoring_unified/updateOne.yml +118 -0
  122. data/spec/spec_tests/data/crud_unified/distinct-comment.yml +98 -0
  123. data/spec/spec_tests/data/gridfs_unified/delete.yml +198 -0
  124. data/spec/spec_tests/data/gridfs_unified/download.yml +241 -0
  125. data/spec/spec_tests/data/gridfs_unified/downloadByName.yml +159 -0
  126. data/spec/spec_tests/data/gridfs_unified/upload-disableMD5.yml +92 -0
  127. data/spec/spec_tests/data/gridfs_unified/upload.yml +288 -0
  128. data/spec/spec_tests/gridfs_unified_spec.rb +13 -0
  129. data/spec/stress/connection_pool_timing_spec.rb +2 -2
  130. data/spec/support/background_thread_registry.rb +3 -13
  131. data/spec/support/certificates/atlas-ocsp-ca.crt +40 -47
  132. data/spec/support/certificates/atlas-ocsp.crt +101 -106
  133. data/spec/support/crypt.rb +57 -13
  134. data/spec/support/macros.rb +10 -0
  135. data/spec/support/spec_config.rb +4 -0
  136. data.tar.gz.sig +0 -0
  137. metadata +1271 -1219
  138. metadata.gz.sig +0 -0
  139. data/spec/spec_tests/command_monitoring_spec.rb +0 -71
  140. data/spec/spec_tests/data/command_monitoring/bulkWrite.yml +0 -49
  141. data/spec/spec_tests/data/command_monitoring/command.yml +0 -61
  142. data/spec/spec_tests/data/command_monitoring/deleteMany.yml +0 -55
  143. data/spec/spec_tests/data/command_monitoring/deleteOne.yml +0 -55
  144. data/spec/spec_tests/data/command_monitoring/find.yml +0 -266
  145. data/spec/spec_tests/data/command_monitoring/insertMany.yml +0 -75
  146. data/spec/spec_tests/data/command_monitoring/insertOne.yml +0 -51
  147. data/spec/spec_tests/data/command_monitoring/unacknowledgedBulkWrite.yml +0 -34
  148. data/spec/spec_tests/data/command_monitoring/updateMany.yml +0 -65
  149. data/spec/spec_tests/data/command_monitoring/updateOne.yml +0 -90
@@ -1,34 +0,0 @@
1
- data:
2
- - { _id: 1, x: 11 }
3
-
4
- collection_name: &collection_name "test"
5
- database_name: &database_name "ruby-driver"
6
-
7
- tests:
8
- -
9
- description: "A successful unordered bulk write with an unacknowledged write concern"
10
- comment: "On a 2.4 server, no GLE is sent and requires a client-side manufactured reply"
11
- operation:
12
- name: "bulkWrite"
13
- arguments:
14
- requests:
15
- - name: "insertOne"
16
- arguments:
17
- document: { _id: "unorderedBulkWriteInsertW0", x: 44 }
18
- options: { ordered: false }
19
- writeConcern: { w: 0 }
20
- expectations:
21
- -
22
- command_started_event:
23
- command:
24
- insert: *collection_name
25
- documents:
26
- - { _id: "unorderedBulkWriteInsertW0", x: 44 }
27
- ordered: false
28
- writeConcern: { w: 0 }
29
- command_name: "insert"
30
- database_name: *database_name
31
- -
32
- command_succeeded_event:
33
- reply: { ok: 1.0 }
34
- command_name: "insert"
@@ -1,65 +0,0 @@
1
- data:
2
- - { _id: 1, x: 11 }
3
- - { _id: 2, x: 22 }
4
- - { _id: 3, x: 33 }
5
-
6
- collection_name: &collection_name "test"
7
- database_name: &database_name "ruby-driver"
8
-
9
- tests:
10
- -
11
- description: "A successful update many"
12
- operation:
13
- name: "updateMany"
14
- arguments:
15
- filter:
16
- _id: { $gt: 1 }
17
- update:
18
- $inc: { x: 1 }
19
- expectations:
20
- -
21
- command_started_event:
22
- command:
23
- update: *collection_name
24
- ordered: true
25
- updates:
26
- -
27
- q: { _id: { $gt: 1 }}
28
- u: { $inc: { x: 1 }}
29
- multi: true
30
- command_name: "update"
31
- database_name: *database_name
32
- -
33
- command_succeeded_event:
34
- reply: { ok: 1.0, n: 2 }
35
- command_name: "update"
36
- -
37
- description: "A successful update many command with write errors"
38
- operation:
39
- name: "updateMany"
40
- arguments:
41
- filter:
42
- _id: { $gt: 1 }
43
- update:
44
- $nothing: { x: 1 }
45
- expectations:
46
- -
47
- command_started_event:
48
- command:
49
- update: *collection_name
50
- ordered: true
51
- updates:
52
- -
53
- q: { _id: { $gt: 1 }}
54
- u: { $nothing: { x: 1 }}
55
- multi: true
56
- command_name: "update"
57
- database_name: *database_name
58
- -
59
- command_succeeded_event:
60
- reply:
61
- ok: 1.0
62
- n: 0
63
- writeErrors:
64
- - { index: 0, code: 42, errmsg: "" }
65
- command_name: "update"
@@ -1,90 +0,0 @@
1
- data:
2
- - { _id: 1, x: 11 }
3
- - { _id: 2, x: 22 }
4
- - { _id: 3, x: 33 }
5
-
6
- collection_name: &collection_name "test"
7
- database_name: &database_name "ruby-driver"
8
-
9
- tests:
10
- -
11
- description: "A successful update one"
12
- operation:
13
- name: "updateOne"
14
- arguments:
15
- filter:
16
- _id: { $gt: 1 }
17
- update:
18
- $inc: { x: 1 }
19
- expectations:
20
- -
21
- command_started_event:
22
- command:
23
- update: *collection_name
24
- ordered: true
25
- updates:
26
- -
27
- q: { _id: { $gt: 1 }}
28
- u: { $inc: { x: 1 }}
29
- command_name: "update"
30
- database_name: *database_name
31
- -
32
- command_succeeded_event:
33
- reply: { ok: 1.0, n: 1 }
34
- command_name: "update"
35
- -
36
- description: "A successful update one with upsert when the upserted id is not an object id"
37
- operation:
38
- name: "updateOne"
39
- arguments:
40
- filter:
41
- _id: 4
42
- update:
43
- $inc: { x: 1 }
44
- upsert: true
45
- expectations:
46
- -
47
- command_started_event:
48
- command:
49
- update: *collection_name
50
- ordered: true
51
- updates:
52
- -
53
- q: { _id: 4 }
54
- u: { $inc: { x: 1 } }
55
- upsert: true
56
- command_name: "update"
57
- database_name: *database_name
58
- -
59
- command_succeeded_event:
60
- reply: { ok: 1.0, n: 1, upserted: [{ index: 0, _id: 4 }] }
61
- command_name: "update"
62
- -
63
- description: "A successful update one command with write errors"
64
- operation:
65
- name: "updateOne"
66
- arguments:
67
- filter:
68
- _id: { $gt: 1 }
69
- update:
70
- $nothing: { x: 1 }
71
- expectations:
72
- -
73
- command_started_event:
74
- command:
75
- update: *collection_name
76
- ordered: true
77
- updates:
78
- -
79
- q: { _id: { $gt: 1 }}
80
- u: { $nothing: { x: 1 }}
81
- command_name: "update"
82
- database_name: *database_name
83
- -
84
- command_succeeded_event:
85
- reply:
86
- ok: 1.0
87
- n: 0
88
- writeErrors:
89
- - { index: 0, code: 42, errmsg: "" }
90
- command_name: "update"