/src/mongo/gotools/src/github.com/mongodb/mongo-tools/vendor/go.mongodb.org/mongo-driver/data/transactions/write-concern.yml

https://github.com/paralect/mongo · YAML · 554 lines · 487 code · 63 blank · 4 comment · 0 complexity · 40d9513ef16bba8bc786705244a4db08 MD5 · raw file

  1. # Assumes the default for transactions is the same as for all ops, tests
  2. # setting the writeConcern to "majority".
  3. runOn:
  4. -
  5. minServerVersion: "4.0"
  6. topology: ["replicaset"]
  7. -
  8. minServerVersion: "4.1.8"
  9. topology: ["sharded"]
  10. database_name: &database_name "transaction-tests"
  11. collection_name: &collection_name "test"
  12. data: &data
  13. - _id: 0
  14. tests:
  15. - description: commit with majority
  16. operations:
  17. - name: startTransaction
  18. object: session0
  19. arguments:
  20. options:
  21. writeConcern:
  22. w: majority
  23. - name: insertOne
  24. object: collection
  25. arguments:
  26. session: session0
  27. document:
  28. _id: 1
  29. result:
  30. insertedId: 1
  31. - &commitTransaction
  32. name: commitTransaction
  33. object: session0
  34. expectations:
  35. - &insertOneEvent
  36. command_started_event:
  37. command:
  38. insert: *collection_name
  39. documents:
  40. - _id: 1
  41. ordered: true
  42. <<: &transactionCommandArgs
  43. lsid: session0
  44. txnNumber:
  45. $numberLong: "1"
  46. startTransaction: true
  47. autocommit: false
  48. readConcern:
  49. writeConcern:
  50. command_name: insert
  51. database_name: *database_name
  52. - command_started_event:
  53. command:
  54. commitTransaction: 1
  55. lsid: session0
  56. txnNumber:
  57. $numberLong: "1"
  58. startTransaction:
  59. autocommit: false
  60. writeConcern:
  61. w: majority
  62. command_name: commitTransaction
  63. database_name: admin
  64. outcome:
  65. collection:
  66. data:
  67. - _id: 0
  68. - _id: 1
  69. - description: commit with default
  70. operations:
  71. - &startTransaction
  72. name: startTransaction
  73. object: session0
  74. - name: insertOne
  75. object: collection
  76. arguments:
  77. session: session0
  78. document:
  79. _id: 1
  80. result:
  81. insertedId: 1
  82. - *commitTransaction
  83. expectations:
  84. - command_started_event:
  85. command:
  86. insert: *collection_name
  87. documents:
  88. - _id: 1
  89. ordered: true
  90. <<: *transactionCommandArgs
  91. command_name: insert
  92. database_name: *database_name
  93. - &commitWithDefaultWCEvent
  94. command_started_event:
  95. command:
  96. commitTransaction: 1
  97. lsid: session0
  98. txnNumber:
  99. $numberLong: "1"
  100. startTransaction:
  101. autocommit: false
  102. writeConcern:
  103. command_name: commitTransaction
  104. database_name: admin
  105. outcome:
  106. collection:
  107. data:
  108. - _id: 0
  109. - _id: 1
  110. - description: abort with majority
  111. operations:
  112. - name: startTransaction
  113. object: session0
  114. arguments:
  115. options:
  116. writeConcern:
  117. w: majority
  118. - name: insertOne
  119. object: collection
  120. arguments:
  121. session: session0
  122. document:
  123. _id: 1
  124. result:
  125. insertedId: 1
  126. - name: abortTransaction
  127. object: session0
  128. expectations:
  129. - command_started_event:
  130. command:
  131. insert: *collection_name
  132. documents:
  133. - _id: 1
  134. ordered: true
  135. <<: *transactionCommandArgs
  136. command_name: insert
  137. database_name: *database_name
  138. - command_started_event:
  139. command:
  140. abortTransaction: 1
  141. lsid: session0
  142. txnNumber:
  143. $numberLong: "1"
  144. startTransaction:
  145. autocommit: false
  146. writeConcern:
  147. w: majority
  148. command_name: abortTransaction
  149. database_name: admin
  150. outcome:
  151. collection:
  152. data: *data
  153. - description: abort with default
  154. operations:
  155. - name: startTransaction
  156. object: session0
  157. - name: insertOne
  158. object: collection
  159. arguments:
  160. session: session0
  161. document:
  162. _id: 1
  163. result:
  164. insertedId: 1
  165. - name: abortTransaction
  166. object: session0
  167. expectations:
  168. - command_started_event:
  169. command:
  170. insert: *collection_name
  171. documents:
  172. - _id: 1
  173. ordered: true
  174. <<: *transactionCommandArgs
  175. command_name: insert
  176. database_name: *database_name
  177. - command_started_event:
  178. command:
  179. abortTransaction: 1
  180. lsid: session0
  181. txnNumber:
  182. $numberLong: "1"
  183. startTransaction:
  184. autocommit: false
  185. writeConcern:
  186. command_name: abortTransaction
  187. database_name: admin
  188. outcome:
  189. collection:
  190. data: *data
  191. - description: start with unacknowledged write concern
  192. operations:
  193. - name: startTransaction
  194. object: session0
  195. arguments:
  196. options:
  197. writeConcern:
  198. w: 0
  199. result:
  200. # Client-side error.
  201. errorContains: transactions do not support unacknowledged write concern
  202. - description: start with implicit unacknowledged write concern
  203. clientOptions:
  204. w: 0
  205. operations:
  206. - name: startTransaction
  207. object: session0
  208. result:
  209. # Client-side error.
  210. errorContains: transactions do not support unacknowledged write concern
  211. - description: unacknowledged write concern coll insertOne
  212. operations:
  213. - *startTransaction
  214. - name: insertOne
  215. <<: &collection_w0
  216. object: collection
  217. collectionOptions:
  218. writeConcern: { w: 0 }
  219. arguments:
  220. session: session0
  221. document:
  222. _id: 1
  223. result:
  224. insertedId: 1
  225. - *commitTransaction
  226. expectations:
  227. - *insertOneEvent
  228. - *commitWithDefaultWCEvent
  229. outcome:
  230. collection:
  231. data:
  232. - _id: 0
  233. - _id: 1
  234. - description: unacknowledged write concern coll insertMany
  235. operations:
  236. - *startTransaction
  237. - name: insertMany
  238. <<: *collection_w0
  239. arguments:
  240. session: session0
  241. documents:
  242. - _id: 1
  243. - _id: 2
  244. result:
  245. insertedIds: {0: 1, 1: 2}
  246. - *commitTransaction
  247. expectations:
  248. - command_started_event:
  249. command:
  250. insert: *collection_name
  251. documents:
  252. - _id: 1
  253. - _id: 2
  254. ordered: true
  255. <<: *transactionCommandArgs
  256. command_name: insert
  257. database_name: *database_name
  258. - *commitWithDefaultWCEvent
  259. outcome:
  260. collection:
  261. data:
  262. - _id: 0
  263. - _id: 1
  264. - _id: 2
  265. - description: unacknowledged write concern coll bulkWrite
  266. operations:
  267. - *startTransaction
  268. - name: bulkWrite
  269. <<: *collection_w0
  270. arguments:
  271. session: session0
  272. requests:
  273. - name: insertOne
  274. arguments:
  275. document: {_id: 1}
  276. result:
  277. deletedCount: 0
  278. insertedCount: 1
  279. insertedIds: {0: 1}
  280. matchedCount: 0
  281. modifiedCount: 0
  282. upsertedCount: 0
  283. upsertedIds: {}
  284. - *commitTransaction
  285. expectations:
  286. - *insertOneEvent
  287. - *commitWithDefaultWCEvent
  288. outcome:
  289. collection:
  290. data:
  291. - _id: 0
  292. - _id: 1
  293. - description: unacknowledged write concern coll deleteOne
  294. operations:
  295. - *startTransaction
  296. - name: deleteOne
  297. <<: *collection_w0
  298. arguments:
  299. session: session0
  300. filter:
  301. _id: 0
  302. result:
  303. deletedCount: 1
  304. - *commitTransaction
  305. expectations:
  306. - command_started_event:
  307. command:
  308. delete: *collection_name
  309. deletes:
  310. - q: {_id: 0}
  311. limit: 1
  312. ordered: true
  313. <<: *transactionCommandArgs
  314. command_name: delete
  315. database_name: *database_name
  316. - *commitWithDefaultWCEvent
  317. outcome:
  318. collection:
  319. data: []
  320. - description: unacknowledged write concern coll deleteMany
  321. operations:
  322. - *startTransaction
  323. - name: deleteMany
  324. <<: *collection_w0
  325. arguments:
  326. session: session0
  327. filter:
  328. _id: 0
  329. result:
  330. deletedCount: 1
  331. - *commitTransaction
  332. expectations:
  333. - command_started_event:
  334. command:
  335. delete: *collection_name
  336. deletes:
  337. - q: {_id: 0}
  338. limit: 0
  339. ordered: true
  340. <<: *transactionCommandArgs
  341. command_name: delete
  342. database_name: *database_name
  343. - *commitWithDefaultWCEvent
  344. outcome:
  345. collection:
  346. data: []
  347. - description: unacknowledged write concern coll updateOne
  348. operations:
  349. - *startTransaction
  350. - name: updateOne
  351. <<: *collection_w0
  352. arguments:
  353. session: session0
  354. filter: {_id: 0}
  355. update:
  356. $inc: {x: 1}
  357. upsert: true
  358. result:
  359. matchedCount: 1
  360. modifiedCount: 1
  361. upsertedCount: 0
  362. - *commitTransaction
  363. expectations:
  364. - command_started_event:
  365. command:
  366. update: *collection_name
  367. updates:
  368. - q: {_id: 0}
  369. u: {$inc: {x: 1}}
  370. upsert: true
  371. ordered: true
  372. <<: *transactionCommandArgs
  373. command_name: update
  374. database_name: *database_name
  375. - *commitWithDefaultWCEvent
  376. outcome:
  377. collection:
  378. data:
  379. - {_id: 0, x: 1}
  380. - description: unacknowledged write concern coll updateMany
  381. operations:
  382. - *startTransaction
  383. - name: updateMany
  384. <<: *collection_w0
  385. arguments:
  386. session: session0
  387. filter: {_id: 0}
  388. update:
  389. $inc: {x: 1}
  390. upsert: true
  391. result:
  392. matchedCount: 1
  393. modifiedCount: 1
  394. upsertedCount: 0
  395. - *commitTransaction
  396. expectations:
  397. - command_started_event:
  398. command:
  399. update: *collection_name
  400. updates:
  401. - q: {_id: 0}
  402. u: {$inc: {x: 1}}
  403. multi: true
  404. upsert: true
  405. ordered: true
  406. <<: *transactionCommandArgs
  407. command_name: update
  408. database_name: *database_name
  409. - *commitWithDefaultWCEvent
  410. outcome:
  411. collection:
  412. data:
  413. - {_id: 0, x: 1}
  414. - description: unacknowledged write concern coll findOneAndDelete
  415. operations:
  416. - *startTransaction
  417. - name: findOneAndDelete
  418. <<: *collection_w0
  419. arguments:
  420. session: session0
  421. filter: {_id: 0}
  422. result: {_id: 0}
  423. - *commitTransaction
  424. expectations:
  425. - command_started_event:
  426. command:
  427. findAndModify: *collection_name
  428. query: {_id: 0}
  429. remove: True
  430. <<: *transactionCommandArgs
  431. command_name: findAndModify
  432. database_name: *database_name
  433. - *commitWithDefaultWCEvent
  434. outcome:
  435. collection:
  436. data: []
  437. - description: unacknowledged write concern coll findOneAndReplace
  438. operations:
  439. - *startTransaction
  440. - name: findOneAndReplace
  441. <<: *collection_w0
  442. arguments:
  443. session: session0
  444. filter: {_id: 0}
  445. replacement: {x: 1}
  446. returnDocument: Before
  447. result: {_id: 0}
  448. - *commitTransaction
  449. expectations:
  450. - command_started_event:
  451. command:
  452. findAndModify: *collection_name
  453. query: {_id: 0}
  454. update: {x: 1}
  455. new: false
  456. <<: *transactionCommandArgs
  457. command_name: findAndModify
  458. database_name: *database_name
  459. - *commitWithDefaultWCEvent
  460. outcome:
  461. collection:
  462. data:
  463. - {_id: 0, x: 1}
  464. - description: unacknowledged write concern coll findOneAndUpdate
  465. operations:
  466. - *startTransaction
  467. - name: findOneAndUpdate
  468. <<: *collection_w0
  469. arguments:
  470. session: session0
  471. filter: {_id: 0}
  472. update:
  473. $inc: {x: 1}
  474. returnDocument: Before
  475. result: {_id: 0}
  476. - *commitTransaction
  477. expectations:
  478. - command_started_event:
  479. command:
  480. findAndModify: *collection_name
  481. query: {_id: 0}
  482. update: {$inc: {x: 1}}
  483. new: false
  484. <<: *transactionCommandArgs
  485. command_name: findAndModify
  486. database_name: *database_name
  487. - *commitWithDefaultWCEvent
  488. outcome:
  489. collection:
  490. data:
  491. - {_id: 0, x: 1}