Skip to content

CLOUDP-312879: Add search reconciler test #232

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
merged 2 commits into from
Jul 7, 2025

Conversation

anandsyncs
Copy link
Contributor

@anandsyncs anandsyncs commented Jul 6, 2025

Summary

This pull request adds unit tests for the MongoDBSearchReconciler in the operator package. These tests cover various reconciliation scenarios, including success cases, failure cases, and edge cases. Additionally, helper functions and mock setups are added.

Unit Tests for MongoDBSearchReconciler:

  • Basic Reconciliation Scenarios:

    • Added tests for successful reconciliation (TestMongoDBSearchReconcile_Success) and scenarios where the MongoDBSearch resource or its source is missing (TestMongoDBSearchReconcile_NotFound, TestMongoDBSearchReconcile_MissingSource).
  • Failure Cases:

    • Implemented tests to validate failure conditions, such as unsupported MongoDB versions (TestMongoDBSearchReconcile_InvalidVersion), TLS-enabled configurations (TestMongoDBSearchReconcile_TLSNotSupported), and multiple MongoDBSearch resources referencing the same MongoDB instance (TestMongoDBSearchReconcile_MultipleSearchResources).

Helper Functions and Mock Setup:

  • Helper Functions:
    • Added helper functions to create mock MongoDBCommunity and MongoDBSearch resources (newMongoDBCommunity, newMongoDBSearch) and build expected configurations (buildExpectedMongotConfig).

Proof of Work

Tests Pass

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you checked for release_note changes?

Reminder (Please remove this when merging)

  • Please try to Approve or Reject Changes the PR, keep PRs in review as short as possible
  • Our Short Guide for PRs: Link
  • Remember the following Communication Standards - use comment prefixes for clarity:
    • blocking: Must be addressed before approval.
    • follow-up: Can be addressed in a later PR or ticket.
    • q: Clarifying question.
    • nit: Non-blocking suggestions.
    • note: Side-note, non-actionable. Example: Praise
    • --> no prefix is considered a question

@anandsyncs anandsyncs marked this pull request as ready for review July 6, 2025 23:14
@anandsyncs anandsyncs requested a review from a team as a code owner July 6, 2025 23:14
@anandsyncs anandsyncs marked this pull request as draft July 6, 2025 23:14
@anandsyncs anandsyncs changed the title add search reconciler test CLOUDP-312879: Add search reconciler test Jul 7, 2025
@anandsyncs anandsyncs marked this pull request as ready for review July 7, 2025 08:28
@anandsyncs anandsyncs requested a review from lsierant July 7, 2025 13:18
@anandsyncs anandsyncs merged commit 16e1d78 into master Jul 7, 2025
35 checks passed
@anandsyncs anandsyncs deleted the anandsingh/mongodb-search-reconciler-tests branch July 7, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants