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

feat: do not overwrite registered mocks in tests #1828

Conversation

paullatzelsperger
Copy link
Member

@paullatzelsperger paullatzelsperger commented Aug 16, 2022

What this PR changes/adds

This PR introduces a subclass of DefaultServiceExtensionContext that maintains a list of service mocks (in addition to the normal services).

Then, when services are to be registered or resolved, that list of mocks is queried first to make sure, that mocks are always used first.

Why it does that

When service mocks are registered, we need to make sure they do not get overwritten by the normal extension loading.

Further notes

.

Linked Issue(s)

Closes #1819

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • assigned appropriate label? (exclude from changelog with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

@paullatzelsperger paullatzelsperger force-pushed the feature/do_not_overwrite_mockregistrations_in_itests branch from 322d19d to e16f5c5 Compare August 16, 2022 10:54
@paullatzelsperger
Copy link
Member Author

@marcgs I added you as a reviewer, because IIRC it was you who was involved in downstream issues with this.

@paullatzelsperger paullatzelsperger marked this pull request as ready for review August 16, 2022 10:58
@marcgs
Copy link
Contributor

marcgs commented Aug 16, 2022

Verified with CredentialsVerifierExtensionTest in IdentityHub: agera-edc/IdentityHub@3fdf69a

@paullatzelsperger paullatzelsperger merged commit 9841a4e into eclipse-edc:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core feature enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: do not overwrite registered mocks in integration tests
3 participants