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

Tests that make sure user provided implementations of interfaces have expected ServiceLifetime #757

Open
martinothamar opened this issue Sep 10, 2024 · 1 comment
Assignees

Comments

@martinothamar
Copy link
Contributor

Description

If an app developer registers an IInstanceProcessor as Transient, we should always instantiate it transiently (not accidentally make it a singleton by rooting it in some other service). Ideally we would not have to, but this is the least surprising behavior as app devs typically aren't concerned with what they put in constructors (ref the IHttpContextAccessor leak incident).

We should develop tests that ensure that all (commonly implemented) public interfaces live for the expected duration.

Additional Information

No response

Tasks

  • Get a list of common user-implementable interfaces which we should develop lifetime tests for
  • Implement tests

Acceptance Criterias

  • When IInstantiationProcessor services are registrered as Transient, they are instantiated with each invocation of IProcessEventHandlerDelegator (or downstream services/deps) methods
  • The above criteria should be true for any other user implemented interface
@martinothamar martinothamar added kind/chore status/draft Status: When you create an issue before you have enough info to properly describe the issue. labels Sep 10, 2024
@martinothamar martinothamar self-assigned this Sep 10, 2024
@martinothamar martinothamar removed status/draft Status: When you create an issue before you have enough info to properly describe the issue. status/triage labels Sep 10, 2024
@martinothamar
Copy link
Contributor Author

A list of interfaces

eFormidling:

  • IEFormidlingMetadata
  • IEFormidlingReceivers

validation:

  • IDataElementValidator
  • IFormDataValidator
  • IInstanceValidator
  • IInstantiationValidator
  • ITaskValidator
  • IFileValidator
  • IFileAnalyser

process:

  • IProcessExclusiveGateway
  • IProcessTaskAbandon
  • IProcessTaskEnd
  • IProcessTaskStart
  • IProcessTask
  • IServiceTask
  • IUserAction
  • IUserActionAuthorizer

events:

  • IEventHandler
  • IEventSecretCodeProvider

data:

  • IInstantiationProcessor
  • IDataProcessor
  • IExternalApiClient

payment:

  • IOrderDetailsCalculator
  • IPaymentProcessor

options (?):

  • IInstanceAppOptionsProvider
  • IAppOptionsProvider
  • IAppOptionsFileHandler

datalist (?):

  • IDataListProvider
  • IInstanceDataListProvider

misc:

  • IPageOrder
  • IPdfFormatter
  • IAppEvents
  • IX509CertificateProvider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👷 In Progress
Development

No branches or pull requests

1 participant