Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Testsuite PoC - Support configurable lifecycle for injected entities #30610

@stianst

Description

@stianst

Currently the lifecycle for an injected entity is hardcoded by the supplier, but for some entity types like realms, clients, and users it should be possible to configure the lifecycle within the test.

We should support global, class, or method as lifecycles.

If not specified the lifecycle should be defined by the supplier. For example the default for the realm supplier is class, but it should be possible in a given test to clear that the realm can be re-used:

@TestRealm(lifecycle = global)
RealmResource realm

Or, even if the test needs the realm to be re-created per-test method that should also be possible:

@TestRealm(lifecycle = method)
RealmResource realm

Some thought should be given to the fact that when deleting a parent resource (like a realm) it is not needed to also deleted the child resource (for example client) separately. For example if both realm and clients have the same lifecycle only the realm should be explicitly deleted. This can potentially be handled by supplier by telling them whether or not the parent will be deleted at the same time. This optimisation can be done in a follow-up issue.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions