Skip to content

Commit f598ba0

Browse files
authored
fix(connection-storage): disable ampersand validations COMPASS-5968 (#3263)
* fix(connection-storage): disable ampersand validations * update test title
1 parent a1d129c commit f598ba0

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

packages/data-service/src/connection-storage.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,32 @@ describe('ConnectionStorage', function () {
374374
});
375375
});
376376
});
377+
378+
it('does not trigger old connection-model validations', async function () {
379+
const connectionStorage = new ConnectionStorage();
380+
const id = uuid();
381+
await connectionStorage.save({
382+
id,
383+
connectionOptions: {
384+
connectionString:
385+
'mongodb://localhost:27017/?tls=true&tlsCertificateKeyFile=%2FUsers%2Fmaurizio%2FDownloads%2FX509-cert-2577072670755779500.pem',
386+
},
387+
});
388+
389+
await eventually(() => {
390+
const { connectionInfo } = JSON.parse(
391+
fs.readFileSync(getConnectionFilePath(tmpDir, id), 'utf-8')
392+
);
393+
394+
expect(connectionInfo).to.deep.equal({
395+
id,
396+
connectionOptions: {
397+
connectionString:
398+
'mongodb://localhost:27017/?tls=true&tlsCertificateKeyFile=%2FUsers%2Fmaurizio%2FDownloads%2FX509-cert-2577072670755779500.pem',
399+
},
400+
});
401+
});
402+
});
377403
});
378404

379405
describe('destroy', function () {

packages/data-service/src/connection-storage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class ConnectionStorage {
7979
model.save(undefined, {
8080
success: resolve,
8181
error: reject,
82+
validate: false,
8283
});
8384
});
8485
} catch (err) {

packages/data-service/src/legacy/legacy-connection-model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export interface LegacyConnectionModelProperties {
156156
export interface AmpersandMethodOptions<T> {
157157
success: (model: T) => void;
158158
error: (model: T, error: Error) => void;
159+
validate?: boolean;
159160
}
160161

161162
export interface LegacyConnectionModel extends LegacyConnectionModelProperties {

0 commit comments

Comments
 (0)