-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Improves CompositionStrategy
and ExtensionManager
and adds unit tests for CompositionStrategy
#18195
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
Conversation
src/OrchardCore/OrchardCore/Shell/Builders/ShellContainerFactory.cs
Outdated
Show resolved
Hide resolved
Could you please check @gvkries? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking to ask about unit tests, but it's good to have them on this PR
src/OrchardCore/OrchardCore/Shell/Builders/CompositionStrategy.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore/Shell/Builders/ShellContainerFactory.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Hisham Bin Ateya <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there’s no bug here: ShellBlueprint.Dependencies
should not contain startup types with missing requirements, and this is already enforced by CompositionStrategy
. The extra check for RequireFeaturesAttribute
in ShellContainerFactory
is redundant and shouldn't be added, and the related unit test doesn’t make sense in this context.
That said, the new unit tests for CompositionStrategy
are valuable and the minor improvements to that class are also good changes—those should definitely be kept.
Suggested actions:
Remove the duplicate check in ShellContainerFactory
and its associated test.
Keep the new tests and refactoring in CompositionStrategy
.
Thanks!
@gvkries if you're suggesting that the startup unit test is invalid, I suggest we proof that there indeed no issue in our code base. Are you able to repo @Piedone raised issue outside the unit tests? If this indeed is not a problem, then I don't see how Zoltan could have encountered the issue. Something is missing here are we should ensure that the RequiredFeatures is doing what it is intended to do. The ConfigureServices, Configure and ConfigureAsync should not be called if at least one of the listed features is not enabled. |
Yes, your new unit tests for
I've not been able to reproduce the issue in OC. Every startup with unmet require attribute is correctly skipped and never instantiated while I was testing it. |
Replied under CrestApps/CrestApps.OrchardCore#136 since there's more conversation. See CrestApps/CrestApps.OrchardCore#136 (comment). |
The `IExtensionManager` interface now includes new methods for retrieving features and loading them asynchronously using `IEnumerable<string>` instead of `string[]`. The previous methods are marked as obsolete to maintain compatibility. The `ExtensionManager` class has been updated to implement these changes, and several other classes, including `CompositionStrategy` and `DefaultTenantOnlyFeatureValidationProvider`, have been modified to use the new method signatures, enhancing type safety across the codebase.
CompositionStrategy
and ExtensionManager
and adds unit tests for CompositionStrategy
@MikeAlhayek I've finalized your PR, hope you're okay with that. I've taken the new unit tests and the improvements for the |
@gvkries thank you! Sorry I have not had much time to complete it. Thanks for doing it. |
@MikeAlhayek As we are discussing about breaking changes in #18241, what do you think about this one here. I added a new overload in the |
@gvkries I think the change you added here are valid. In this case, you won't encounter and unexpected runtime exception because the same signature "as before" still exists which. |
This pull request improves the
CompositionStrategy
andExtensionManager
components in OrchardCore. It also introduces comprehensive unit tests forCompositionStrategy
to ensure reliability and maintainability.