Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .evergreen/print-compass-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

export MONGODB_DEFAULT_VERSION=6.0.x
export MONGODB_DEFAULT_VERSION=7.0.x
Copy link
Contributor Author

@lerouxb lerouxb Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we should probably not set this here and use it in print-compass-env.js and then somehow rather fill in a default if nothing is set in the compass tests. That would be the only way to have a consistent default locally and in CI because we don't use this file when just doing npm test locally.


if [[ $OSTYPE == "cygwin" ]]; then
export PLATFORM='win32'
Expand Down
6 changes: 4 additions & 2 deletions packages/data-service/src/connect-mongo-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,10 @@ describe('connectMongoClient', function () {
expect(error).to.be.instanceOf(Error);

// propagates the tunnel error
expect(error.message).to.match(
/(All configured authentication methods failed|ENOTFOUND compass-tests\.fakehost\.localhost)/
// NOTE: this heavily depends on which server version we're running on
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have to test for a specific message? can't we just confirm an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I didn't write the original test and I don't want to unnecessarily change the intention.

Copy link
Collaborator

@paula-stacho paula-stacho Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, if we want to test the propagation, is there a way to mock the server error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this file is an integration test, not a unit test.

const message = error.errors ? error.errors[0].message : error.message;
expect(message).to.match(
/(All configured authentication methods failed|ENOTFOUND compass-tests\.fakehost\.localhost)|ECONNREFUSED 127.0.0.1:22/
);

for (let i = 0; i < 10; i++) {
Expand Down
20 changes: 4 additions & 16 deletions packages/data-service/src/data-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1199,10 +1199,7 @@ describe('DataService', function () {
it('throws an error', async function () {
await expect(
dataService.getSearchIndexes(testNamespace)
).to.be.rejectedWith(
MongoServerError,
/Unrecognized pipeline stage name: '\$listSearchIndexes'"|\$listSearchIndexes stage is only allowed on MongoDB Atlas/
);
).to.be.rejectedWith(MongoServerError);
});
});

Expand All @@ -1213,32 +1210,23 @@ describe('DataService', function () {
name: 'my-index',
definition: {},
})
).to.be.rejectedWith(
MongoServerError,
"no such command: 'createSearchIndexes'"
);
).to.be.rejectedWith(MongoServerError);
});
});

describe('#updateSearchIndex', function () {
it('throws an error', async function () {
await expect(
dataService.updateSearchIndex(testNamespace, 'my-index', {})
).to.be.rejectedWith(
MongoServerError,
"no such command: 'updateSearchIndex'"
);
).to.be.rejectedWith(MongoServerError);
});
});

describe('#dropSearchIndex', function () {
it('throws an error', async function () {
await expect(
dataService.dropSearchIndex(testNamespace, 'my-index')
).to.be.rejectedWith(
MongoServerError,
"no such command: 'dropSearchIndex'"
);
).to.be.rejectedWith(MongoServerError);
});
});

Expand Down
Loading