Skip to content

Commit 75208b0

Browse files
committed
test(NODE-5464): sync unified oidc spec tests
1 parent a697191 commit 75208b0

File tree

4 files changed

+531
-0
lines changed

4 files changed

+531
-0
lines changed

Diff for: test/spec/auth/unified/oidc-auth-with-retry.json

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"description": "OIDC authentication with retry",
3+
"schemaVersion": "1.18",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "7.0",
7+
"auth": true,
8+
"authMechanism": "MONGODB-OIDC"
9+
}
10+
],
11+
"createEntities": [
12+
{
13+
"client": {
14+
"id": "client0",
15+
"uriOptions": {
16+
"authMechanism": "MONGODB-OIDC",
17+
"authMechanismProperties": {
18+
"$$placeholder": 1
19+
},
20+
"retryReads": true,
21+
"retryWrites": true
22+
},
23+
"observeEvents": [
24+
"commandStartedEvent",
25+
"commandSucceededEvent",
26+
"commandFailedEvent"
27+
]
28+
}
29+
},
30+
{
31+
"database": {
32+
"id": "database0",
33+
"client": "client0",
34+
"databaseName": "test"
35+
}
36+
},
37+
{
38+
"collection": {
39+
"id": "collection0",
40+
"database": "database0",
41+
"collectionName": "collName"
42+
}
43+
}
44+
],
45+
"initialData": [
46+
{
47+
"collectionName": "collName",
48+
"databaseName": "test",
49+
"documents": [
50+
51+
]
52+
}
53+
],
54+
"tests": [
55+
{
56+
"description": "A simple find operation should succeed",
57+
"operations": [
58+
{
59+
"name": "find",
60+
"arguments": {
61+
"filter": {
62+
}
63+
},
64+
"object": "collection0",
65+
"expectResult": [
66+
67+
]
68+
}
69+
],
70+
"expectEvents": [
71+
{
72+
"client": "client0",
73+
"events": [
74+
{
75+
"commandStartedEvent": {
76+
"command": {
77+
"find": "collName",
78+
"filter": {
79+
}
80+
}
81+
}
82+
},
83+
{
84+
"commandSucceededEvent": {
85+
"commandName": "find"
86+
}
87+
}
88+
]
89+
}
90+
]
91+
},
92+
{
93+
"description": "Write command should reauthenticate when receive ReauthenticationRequired error code and retryWrites=true",
94+
"operations": [
95+
{
96+
"name": "failPoint",
97+
"object": "testRunner",
98+
"arguments": {
99+
"client": "client0",
100+
"failPoint": {
101+
"configureFailPoint": "failCommand",
102+
"mode": {
103+
"times": 1
104+
},
105+
"data": {
106+
"failCommands": [
107+
"insert"
108+
],
109+
"errorCode": 391
110+
}
111+
}
112+
}
113+
},
114+
{
115+
"name": "insertOne",
116+
"object": "collection0",
117+
"arguments": {
118+
"document": {
119+
"_id": 1,
120+
"x": 1
121+
}
122+
}
123+
}
124+
],
125+
"expectEvents": [
126+
{
127+
"client": "client0",
128+
"events": [
129+
{
130+
"commandStartedEvent": {
131+
"command": {
132+
"insert": "collName",
133+
"documents": [
134+
{
135+
"_id": 1,
136+
"x": 1
137+
}
138+
]
139+
}
140+
}
141+
},
142+
{
143+
"commandFailedEvent": {
144+
"commandName": "insert"
145+
}
146+
},
147+
{
148+
"commandStartedEvent": {
149+
"command": {
150+
"insert": "collName",
151+
"documents": [
152+
{
153+
"_id": 1,
154+
"x": 1
155+
}
156+
]
157+
}
158+
}
159+
},
160+
{
161+
"commandSucceededEvent": {
162+
"commandName": "insert"
163+
}
164+
}
165+
]
166+
}
167+
]
168+
}
169+
]
170+
}

Diff for: test/spec/auth/unified/oidc-auth-with-retry.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
description: "OIDC authentication with retry"
3+
schemaVersion: "1.18"
4+
runOnRequirements:
5+
- minServerVersion: "7.0"
6+
auth: true
7+
authMechanism: "MONGODB-OIDC"
8+
createEntities:
9+
- client:
10+
id: client0
11+
uriOptions:
12+
authMechanism: "MONGODB-OIDC"
13+
# The $$placeholder document should be replaced by auth mechanism
14+
# properties that enable OIDC auth on the target cloud platform. For
15+
# example, when running the test on AWS, replace the $$placeholder
16+
# document with {"PROVIDER_NAME": "aws"}.
17+
authMechanismProperties: { $$placeholder: 1 }
18+
retryReads: true
19+
retryWrites: true
20+
observeEvents:
21+
- commandStartedEvent
22+
- commandSucceededEvent
23+
- commandFailedEvent
24+
- database:
25+
id: database0
26+
client: client0
27+
databaseName: test
28+
- collection:
29+
id: collection0
30+
database: database0
31+
collectionName: collName
32+
initialData:
33+
- collectionName: collName
34+
databaseName: test
35+
documents: []
36+
tests:
37+
- description: A simple find operation should succeed
38+
operations:
39+
- name: find
40+
arguments:
41+
filter: {}
42+
object: collection0
43+
expectResult: []
44+
expectEvents:
45+
- client: client0
46+
events:
47+
- commandStartedEvent:
48+
command:
49+
find: collName
50+
filter: {}
51+
- commandSucceededEvent:
52+
commandName: find
53+
- description: Write command should reauthenticate when receive ReauthenticationRequired
54+
error code and retryWrites=true
55+
operations:
56+
- name: failPoint
57+
object: testRunner
58+
arguments:
59+
client: client0
60+
failPoint:
61+
configureFailPoint: failCommand
62+
mode:
63+
times: 1
64+
data:
65+
failCommands:
66+
- insert
67+
errorCode: 391
68+
- name: insertOne
69+
object: collection0
70+
arguments:
71+
document:
72+
_id: 1
73+
x: 1
74+
expectEvents:
75+
- client: client0
76+
events:
77+
- commandStartedEvent:
78+
command:
79+
insert: collName
80+
documents:
81+
- _id: 1
82+
x: 1
83+
- commandFailedEvent:
84+
commandName: insert
85+
- commandStartedEvent:
86+
command:
87+
insert: collName
88+
documents:
89+
- _id: 1
90+
x: 1
91+
- commandSucceededEvent:
92+
commandName: insert

0 commit comments

Comments
 (0)