From 323e3896da8bd63bc97c15a4227cd69d2f89ade1 Mon Sep 17 00:00:00 2001 From: Igor Kryvenko Date: Wed, 12 Sep 2018 23:17:37 +0300 Subject: [PATCH] GODRIVER-547: Resync read write concern tests to add new read concern levels --- core/readconcern/readconcern.go | 5 +++++ .../connection-string/read-concern.json | 18 +++++++++++++++ .../connection-string/read-concern.yml | 12 ++++++++++ .../document/read-concern.json | 22 +++++++++++++++++++ .../document/read-concern.yml | 12 ++++++++++ 5 files changed, 69 insertions(+) diff --git a/core/readconcern/readconcern.go b/core/readconcern/readconcern.go index 65c18fab33..79ec17a0e2 100644 --- a/core/readconcern/readconcern.go +++ b/core/readconcern/readconcern.go @@ -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{} diff --git a/data/read-write-concern/connection-string/read-concern.json b/data/read-write-concern/connection-string/read-concern.json index 0cdd6a1dea..960b47f51d 100644 --- a/data/read-write-concern/connection-string/read-concern.json +++ b/data/read-write-concern/connection-string/read-concern.json @@ -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" + } } ] } diff --git a/data/read-write-concern/connection-string/read-concern.yml b/data/read-write-concern/connection-string/read-concern.yml index 1f4e548e60..65de3243ff 100644 --- a/data/read-write-concern/connection-string/read-concern.yml +++ b/data/read-write-concern/connection-string/read-concern.yml @@ -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" } \ No newline at end of file diff --git a/data/read-write-concern/document/read-concern.json b/data/read-write-concern/document/read-concern.json index c7750f665d..950954e0d7 100644 --- a/data/read-write-concern/document/read-concern.json +++ b/data/read-write-concern/document/read-concern.json @@ -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 } ] } diff --git a/data/read-write-concern/document/read-concern.yml b/data/read-write-concern/document/read-concern.yml index 0fd96ef1db..70679151c0 100644 --- a/data/read-write-concern/document/read-concern.yml +++ b/data/read-write-concern/document/read-concern.yml @@ -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 \ No newline at end of file