Skip to content
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

Modify Jenkins Full E2E Integ Test to perform Transformations #1182

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

lewijacn
Copy link
Collaborator

@lewijacn lewijacn commented Dec 6, 2024

Description

Modifies integ test to add transformation to RFS and Metadata migration to rename an index and modify given RFS documents to go to a new index

After facing a lot of difficulty with crafting a transformation and passing as a command argument, added E2E test for DocumentMigration based off a structure recently introduced by Andre to make top level transformation testing in DocumentMigration much easier to test locally.

Issues Resolved

https://opensearch.atlassian.net/browse/MIGRATIONS-2150

Is this a backport? If so, please add backport PR # and/or commits #

Testing

Jenkins and local testing

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.64%. Comparing base (d45f4f3) to head (34c967a).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1182   +/-   ##
=========================================
  Coverage     80.64%   80.64%           
  Complexity     3076     3076           
=========================================
  Files           421      421           
  Lines         15610    15610           
  Branches       1053     1053           
=========================================
  Hits          12588    12588           
  Misses         2381     2381           
  Partials        641      641           
Flag Coverage Δ
unittests 80.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Tanner Lewis <[email protected]>
Signed-off-by: Tanner Lewis <[email protected]>

var sourceClusterOperations = new ClusterOperations(esSourceContainer.getUrl());

var shards = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking: why define this shard count again? Maybe you can use a class-level member instead of redefining.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should be removed now, I've done a good amount of refactoring to remove extra logic for this test class that isn't needed

}
}

private static String createIndexNameTransformation(String existingIndexName, String newIndexName) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you please add a comment explaining what this transform is supposed to accomplish? The method name is a good start, but, frankly, Jolt is inscrutable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

}

@SneakyThrows
private static int runProcessAgainstTarget(
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this was basically copied from the ProcessLifecycleTest. Can you please find a way to share/re-use rather than copy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've done a good amount of refactoring so this should be different, with some shared code move into parent class



@NotNull
private static ProcessBuilder setupProcess(
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this was basically copied from the ProcessLifecycleTest. Can you please find a way to share/re-use rather than copy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines +141 to +142
expected_target_docs[transformed_index_name] = {"count": 1}
check_doc_counts_match(cluster=target_cluster, expected_index_details=expected_target_docs,
Copy link
Member

Choose a reason for hiding this comment

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

I must be missing something here, as I'd expect this check to fail. It appears the index name in the snapshot is the original, and we're passing in a transformation to the backfill process. As a result, I'd expect that the backfill process would create a new index on the target with default settings and the original index name, and put its doc into that.

Can you fill me in on how this check is passing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The backfill process has a transformation to change the index name to the transformed index name, that is specified in the deployment CDK context

expected_docs[index_name] = {"count": 3}
check_doc_counts_match(cluster=source_cluster, expected_index_details=expected_docs,
expected_source_docs[index_name] = {"count": 3}
# TODO Replayer transformation needed to only have docs in the transformed index
Copy link
Member

Choose a reason for hiding this comment

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

Can you please make a follow-up Jira for this work and link it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

# Conflicts:
#	DocumentsFromSnapshotMigration/src/test/java/org/opensearch/migrations/bulkload/LeaseExpirationTest.java
#	DocumentsFromSnapshotMigration/src/test/java/org/opensearch/migrations/bulkload/SourceTestBase.java
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.

2 participants