Skip to content

PCSM. Add cross version test#562

Merged
sandraromanchenko merged 1 commit into
mainfrom
cross_version_support
Jun 1, 2026
Merged

PCSM. Add cross version test#562
sandraromanchenko merged 1 commit into
mainfrom
cross_version_support

Conversation

@sandraromanchenko
Copy link
Copy Markdown
Collaborator

This pull request introduces support for running tests with different MongoDB versions for source and target clusters, enabling cross-version replication and data integrity testing. The changes include updates to the Docker Compose setup, test cluster instantiation, and significant improvements to the data integrity check logic, especially for capped collections.

Key changes:

Cross-version cluster support and Docker Compose updates:

  • Split the single mongodb service in docker-compose.yaml into mongodb-src and mongodb-dst, allowing independent builds and images for source and destination clusters. Environment variables MONGODB_SRC_IMAGE and MONGODB_DST_IMAGE are now supported for per-cluster version selection.
  • Updated the documentation in readme.md to explain how to configure and run tests with different MongoDB versions for source and target.

Test and fixture updates for explicit image selection:

  • All test cluster instantiations (Cluster objects) in test files and fixtures now explicitly set the mongo_image parameter to either mongodb-src/local or mongodb-dst/local, ensuring correct image usage throughout the test suite.
    Data integrity check improvements:
  • Added a robust record-by-record comparison for capped collections (compare_capped_collections), addressing issues where dbHash is not portable across MongoDB versions or clusters due to natural order hashing. This ensures capped collections are validated for correctness regardless of version differences.
  • Modified the database hash comparison to exclude capped collections, delegating their validation to the new comparison function, and improved logging and error handling for collection listing and comparison.

These changes collectively enable reliable cross-version testing and more accurate data integrity validation, especially for capped collections, across independently configured MongoDB source and target clusters.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds cross-version MongoDB test support by separating source and destination MongoDB images and updating data integrity checks to avoid dbHash false positives for capped collections.

Changes:

  • Adds mongodb-src and mongodb-dst compose services with per-side image overrides.
  • Updates test fixtures/examples to pass explicit source or destination MongoDB images.
  • Adds record-by-record capped collection comparison and excludes capped collections from dbHash.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pcsm-pytest/docker-compose.yaml Defines separate source/destination MongoDB build targets.
pcsm-pytest/readme.md Documents cross-version image configuration.
pcsm-pytest/data_integrity_check.py Adds capped collection comparison and filters capped collections from dbHash.
pcsm-pytest/conftest.py Uses source/destination MongoDB images in shared fixtures.
pcsm-pytest/test_arguments_and_env_vars.py Uses explicit MongoDB images in cluster fixtures.
pcsm-pytest/test_connection_rs.py Uses explicit MongoDB images for replica set tests.
pcsm-pytest/test_connection_shard.py Uses explicit MongoDB images for sharded tests.
pcsm-pytest/test_failcommands_rs.py Uses explicit MongoDB images for failcommand tests.
pcsm-pytest/test_load_rs.py Uses explicit MongoDB images for load test clusters.
pcsm-pytest/example_cluster.py Updates example cluster image selection.
pcsm-pytest/example_rs.py Updates replica set example image selection.
pcsm-pytest/example_shard.py Updates sharded example image selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pcsm-pytest/docker-compose.yaml
Comment thread pcsm-pytest/data_integrity_check.py Outdated
Comment thread pcsm-pytest/data_integrity_check.py
@sandraromanchenko sandraromanchenko merged commit 1347279 into main Jun 1, 2026
22 checks passed
@sandraromanchenko sandraromanchenko deleted the cross_version_support branch June 1, 2026 10:54
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