Skip to content

Commit 323e389

Browse files
committed
GODRIVER-547: Resync read write concern tests to add new read concern levels
1 parent 4b810a7 commit 323e389

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

core/readconcern/readconcern.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ func Available() *ReadConcern {
4646
return New(Level("available"))
4747
}
4848

49+
// Only available for operations within multi-document transactions.
50+
func Snapshot() *ReadConcern {
51+
return New(Level("snapshot"))
52+
}
53+
4954
// New constructs a new read concern from the given string.
5055
func New(options ...Option) *ReadConcern {
5156
concern := &ReadConcern{}

data/read-write-concern/connection-string/read-concern.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@
3333
"readConcern": {
3434
"level": "available"
3535
}
36+
},
37+
{
38+
"description": "snapshot specified",
39+
"uri": "mongodb://localhost/?readConcernLevel=snapshot",
40+
"valid": true,
41+
"warning": false,
42+
"readConcern": {
43+
"level": "snapshot"
44+
}
45+
},
46+
{
47+
"description": "linearizable specified",
48+
"uri": "mongodb://localhost/?readConcernLevel=linearizable",
49+
"valid": true,
50+
"warning": false,
51+
"readConcern": {
52+
"level": "linearizable"
53+
}
3654
}
3755
]
3856
}

data/read-write-concern/connection-string/read-concern.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,15 @@ tests:
2323
valid: true
2424
warning: false
2525
readConcern: { level: "available" }
26+
-
27+
description: "snapshot specified"
28+
uri: "mongodb://localhost?readConcernLevel=snapshot"
29+
valid: true
30+
warning: false
31+
readConcern: { level: "snapshot" }
32+
-
33+
description: "linearizable specified"
34+
uri: "mongodb://localhost?readConcernLevel=linearizable"
35+
valid: true
36+
warning: false
37+
readConcern: { level: "linearizable" }

data/read-write-concern/document/read-concern.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@
3939
"level": "available"
4040
},
4141
"isServerDefault": false
42+
},
43+
{
44+
"description": "Snapshot",
45+
"valid": true,
46+
"readConcern": {
47+
"level": "snapshot"
48+
},
49+
"readConcernDocument": {
50+
"level": "snapshot"
51+
},
52+
"isServerDefault": false
53+
},
54+
{
55+
"description": "Linearizable",
56+
"valid": true,
57+
"readConcern": {
58+
"level": "linearizable"
59+
},
60+
"readConcernDocument": {
61+
"level": "linearizable"
62+
},
63+
"isServerDefault": false
4264
}
4365
]
4466
}

data/read-write-concern/document/read-concern.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@ tests:
2222
valid: true
2323
readConcern: { level: "available" }
2424
readConcernDocument: { level: "available" }
25+
isServerDefault: false
26+
-
27+
description: "Snapshot"
28+
valid: true
29+
readConcern: { level: "snapshot" }
30+
readConcernDocument: { level: "snapshot" }
31+
isServerDefault: false
32+
-
33+
description: "Linearizable"
34+
valid: true
35+
readConcern: { level: "linearizable" }
36+
readConcernDocument: { level: "linearizable" }
2537
isServerDefault: false

0 commit comments

Comments
 (0)