Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix tests on Schema index helpers #3236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
GromNaN merged 2 commits into mongodb:5.x from GromNaN:schema-index-tests
Jan 3, 2025
Merged

Conversation

@GromNaN
Copy link
Member

@GromNaN GromNaN commented Jan 2, 2025
edited
Loading

Find index by its actual name instead of the key fields.
Fix wrong assertions checking indexes doesn't exist with the wrong name.

@GromNaN GromNaN requested a review from a team as a code owner January 2, 2025 19:04
@GromNaN GromNaN requested a review from jmikola January 2, 2025 19:04
@GromNaN GromNaN marked this pull request as draft January 2, 2025 19:04
@GromNaN GromNaN force-pushed the schema-index-tests branch 2 times, most recently from 388e5fe to 31e6efe Compare January 2, 2025 19:13
@GromNaN GromNaN marked this pull request as ready for review January 2, 2025 19:17

$index = $this->getIndex('newcollection', 'field_a_-1_field_b_1');
$index = $this->getIndex('newcollection', $indexName);
$this->assertNotNull($index);
Copy link
Member Author

@GromNaN GromNaN Jan 2, 2025

Choose a reason for hiding this comment

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

Here the assertion was always true, $index was false for missing index.

jmikola reacted with thumbs up emoji
Copy link
Member

@jmikola jmikola Jan 2, 2025

Choose a reason for hiding this comment

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

Having assertIndexExists() and assertIndexNotExists() would make the tests more readable if you wanted to go that route. I realize you can't get rid of getIndex() entirely, since some later tests expect to make assertions on the IndexInfo structure.

Copy link
Member Author

@GromNaN GromNaN Jan 2, 2025

Choose a reason for hiding this comment

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

Thanks for the suggestion, that's more explicit with the new assert methods.

@GromNaN GromNaN merged commit aae9170 into mongodb:5.x Jan 3, 2025
27 checks passed
@GromNaN GromNaN deleted the schema-index-tests branch January 3, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jmikola jmikola jmikola approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /