@@ -116,7 +116,9 @@ describe('e2e direct connection', function () {
116
116
await shell . waitForPrompt ( ) ;
117
117
await shell . executeLine ( 'use admin' ) ;
118
118
await shell . executeLine ( 'db.runCommand({ listCollections: 1 })' ) ;
119
- shell . assertContainsError ( 'MongoServerError: not primary' ) ;
119
+ shell . assertContainsError (
120
+ 'MongoServerError[NotPrimaryNoSecondaryOk]: not primary'
121
+ ) ;
120
122
} ) ;
121
123
122
124
it ( 'lists collections when readPreference is in the connection string' , async function ( ) {
@@ -130,7 +132,9 @@ describe('e2e direct connection', function () {
130
132
await shell . waitForPrompt ( ) ;
131
133
await shell . executeLine ( 'use admin' ) ;
132
134
await shell . executeLine ( 'db.runCommand({ listCollections: 1 })' ) ;
133
- shell . assertContainsOutput ( 'MongoServerError: not primary' ) ;
135
+ shell . assertContainsOutput (
136
+ 'MongoServerError[NotPrimaryNoSecondaryOk]: not primary'
137
+ ) ;
134
138
} ) ;
135
139
136
140
it ( 'lists collections when readPreference is set via Mongo' , async function ( ) {
@@ -143,7 +147,9 @@ describe('e2e direct connection', function () {
143
147
'db.getMongo().setReadPref("secondaryPreferred")'
144
148
) ;
145
149
await shell . executeLine ( 'db.runCommand({ listCollections: 1 })' ) ;
146
- shell . assertContainsOutput ( 'MongoServerError: not primary' ) ;
150
+ shell . assertContainsOutput (
151
+ 'MongoServerError[NotPrimaryNoSecondaryOk]: not primary'
152
+ ) ;
147
153
} ) ;
148
154
149
155
it ( 'fails to list databases without explicit readPreference' , async function ( ) {
@@ -153,7 +159,9 @@ describe('e2e direct connection', function () {
153
159
await shell . waitForPrompt ( ) ;
154
160
await shell . executeLine ( 'use admin' ) ;
155
161
await shell . executeLine ( 'db.getMongo().getDBs()' ) ;
156
- shell . assertContainsError ( 'MongoServerError: not primary' ) ;
162
+ shell . assertContainsError (
163
+ 'MongoServerError[NotPrimaryNoSecondaryOk]: not primary'
164
+ ) ;
157
165
} ) ;
158
166
159
167
it ( 'lists databases when readPreference is in the connection string' , async function ( ) {
0 commit comments