File: bulkWrite.yml

package info (click to toggle)
ruby-mongo 2.23.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,020 kB
  • sloc: ruby: 110,810; makefile: 5
file content (87 lines) | stat: -rw-r--r-- 2,670 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
description: "timeoutMS behaves correctly for bulkWrite operations"

schemaVersion: "1.9"

runOnRequirements:
  - minServerVersion: "4.4"

createEntities:
  - client:
      id: &failPointClient failPointClient
      useMultipleMongoses: false
  - client:
      id: &client client
      useMultipleMongoses: false
      observeEvents:
        - commandStartedEvent
      uriOptions:
        # Used to speed up the test
        w: 1
  - database:
      id: &database database
      client: *client
      databaseName: &databaseName test
  - collection:
      id: &collection collection
      database: *database
      collectionName: &collectionName coll 

initialData:
  - collectionName: *collectionName
    databaseName: *databaseName
    documents: []

tests:
  # Test that drivers do not refresh timeoutMS between commands. This is done by running a bulkWrite that will require
  # two commands with timeoutMS=200 and blocking each command for 120ms. The server should take over 200ms total, so the
  # bulkWrite should fail with a timeout error.
  - description: "timeoutMS applied to entire bulkWrite, not individual commands"
    operations:
      # Do an operation without a timeout to ensure the servers are discovered.
      - name: insertOne
        object: *collection
        arguments:
          document: {}
      - name: failPoint
        object: testRunner
        arguments:
          client: *failPointClient
          failPoint:
            configureFailPoint: failCommand
            mode: { times: 2 }
            data:
              failCommands: ["insert", "update"]
              blockConnection: true
              blockTimeMS: 120
      - name: bulkWrite
        object: *collection
        arguments:
          requests:
            - insertOne:
                document: { _id: 1 }
            - replaceOne:
                filter: { _id: 1 }
                replacement: { x: 1 }
          timeoutMS: 200
        expectError:
          isTimeoutError: true
    expectEvents:
      - client: *client
        events:
          - commandStartedEvent:
              commandName: insert
              databaseName: *databaseName
              command:
                insert: *collectionName
          - commandStartedEvent:
              commandName: insert
              databaseName: *databaseName
              command:
                insert: *collectionName
                maxTimeMS: { $$type: ["int", "long"] }
          - commandStartedEvent:
              commandName: update
              databaseName: *databaseName
              command:
                update: *collectionName
                maxTimeMS: { $$type: ["int", "long"] }