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

refactor: e2e pull transfer tests #4733

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

Conversation

AndrYurk
Copy link
Contributor

What this PR changes/adds

Refactor End-to-End (e2e) PULL Transfer Tests.

Why it does that

Please see issue description.

Linked Issue(s)

Closes #4727

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@AndrYurk AndrYurk requested a review from ndr-brt as a code owner January 17, 2025 11:49
@AndrYurk AndrYurk added the refactoring Cleaning up code and dependencies label Jan 17, 2025
@AndrYurk AndrYurk requested a review from jimmarino January 21, 2025 08:35
@AndrYurk AndrYurk force-pushed the refactoring-e2e-transfer-test branch from 3079e66 to 3d85043 Compare January 21, 2025 08:59
Copy link
Contributor

@jimmarino jimmarino left a comment

Choose a reason for hiding this comment

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

I find the code more complex and difficult to reason about than the original due to the added layers of indirection. For example:

createResourcesOnProvider(assetId, PolicyFixtures.contractExpiresIn("10s"), httpSourceDataAddress());
            var startedTransferContext = startTransferProcess(assetId);
            var edrMessageContext = assertDataIsAccessible(startedTransferContext.consumerTransferProcessId);
            assertDataIsNotAccessible(startedTransferContext.consumerTransferProcessId, edrMessageContext);

Compare the above to the original where the checks are well-documented and intuitive.

In tests, it's OK to repeat code if it makes what is being verified easier to follow. There are obviously cases where test fixtures should be used, but generalized methods need to explicitly communicate what verification they are performing.

My suggestion is to try an alternative approach or keep the existing test case structure.

@@ -340,6 +265,55 @@ private HttpResponse cacheEdr(HttpRequest request, Map<String, TransferProcessSt
}
}

private StartedTransferContext startTransferProcess(String assetId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an unnecessary indirection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Cleaning up code and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor End-to-End (e2e) PULL Transfer Tests
2 participants