Skip to content

Commit

Permalink
GODRIVER-547: Resync read write concern tests to add new read concern…
Browse files Browse the repository at this point in the history
… levels
  • Loading branch information
igorKryvenko committed Sep 12, 2018
1 parent 4b810a7 commit 323e389
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/readconcern/readconcern.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func Available() *ReadConcern {
return New(Level("available"))
}

// Only available for operations within multi-document transactions.
func Snapshot() *ReadConcern {
return New(Level("snapshot"))
}

// New constructs a new read concern from the given string.
func New(options ...Option) *ReadConcern {
concern := &ReadConcern{}
Expand Down
18 changes: 18 additions & 0 deletions data/read-write-concern/connection-string/read-concern.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@
"readConcern": {
"level": "available"
}
},
{
"description": "snapshot specified",
"uri": "mongodb://localhost/?readConcernLevel=snapshot",
"valid": true,
"warning": false,
"readConcern": {
"level": "snapshot"
}
},
{
"description": "linearizable specified",
"uri": "mongodb://localhost/?readConcernLevel=linearizable",
"valid": true,
"warning": false,
"readConcern": {
"level": "linearizable"
}
}
]
}
12 changes: 12 additions & 0 deletions data/read-write-concern/connection-string/read-concern.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,15 @@ tests:
valid: true
warning: false
readConcern: { level: "available" }
-
description: "snapshot specified"
uri: "mongodb://localhost?readConcernLevel=snapshot"
valid: true
warning: false
readConcern: { level: "snapshot" }
-
description: "linearizable specified"
uri: "mongodb://localhost?readConcernLevel=linearizable"
valid: true
warning: false
readConcern: { level: "linearizable" }
22 changes: 22 additions & 0 deletions data/read-write-concern/document/read-concern.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@
"level": "available"
},
"isServerDefault": false
},
{
"description": "Snapshot",
"valid": true,
"readConcern": {
"level": "snapshot"
},
"readConcernDocument": {
"level": "snapshot"
},
"isServerDefault": false
},
{
"description": "Linearizable",
"valid": true,
"readConcern": {
"level": "linearizable"
},
"readConcernDocument": {
"level": "linearizable"
},
"isServerDefault": false
}
]
}
12 changes: 12 additions & 0 deletions data/read-write-concern/document/read-concern.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ tests:
valid: true
readConcern: { level: "available" }
readConcernDocument: { level: "available" }
isServerDefault: false
-
description: "Snapshot"
valid: true
readConcern: { level: "snapshot" }
readConcernDocument: { level: "snapshot" }
isServerDefault: false
-
description: "Linearizable"
valid: true
readConcern: { level: "linearizable" }
readConcernDocument: { level: "linearizable" }
isServerDefault: false

0 comments on commit 323e389

Please sign in to comment.