elsa-core/test/integration/Elsa.Workflows.IntegrationTests/Scenarios
Sipke Schoorstra ca268c16ad
Enhances distributed lock handling with resilience (#7161)
* Add retry mechanism for distributed locks with transient error handling and logging

- Introduced Polly-based retry pipeline for distributed lock acquisition in `DistributedWorkflowClient` to handle transient errors such as network issues or database connection failures.
- Added detailed logging for retry attempts and lock release errors.
- Updated project dependencies to include Polly.

* Refactor transient exception handling to shared resilience module.

Migrated transient exception detection logic from scheduling module to a new shared resilience module. Updated services, jobs, and features to utilize the centralized `ITransientExceptionDetectionService`. This change improves maintainability and promotes reusability across modules.

* Add unit tests for transient exception detection and resilience strategy evaluation.

- Introduced comprehensive unit tests for `DefaultTransientExceptionDetector`, `ResilienceStrategyCatalog`, `ResilienceStrategyConfigEvaluator`, and `TransientExceptionDetectionService`.
- Added helper classes and test data factories to facilitate reusable test patterns for resilience modules.
- Updated solution to include `Elsa.Resilience.Core.UnitTests` project.

* Add component tests for distributed lock resilience

- Introduced new tests to verify retry behavior during transient lock acquisition and release failures.
- Added `TestDistributedLockProvider` and related mocks for simulating transient failures.
- Updated `WorkflowServer` test services to support the new distributed lock test scenarios.

* Refactor distributed lock resilience tests

- Consolidated test logic: streamlined test providers, injected services, and reusable test patterns.
- Simplified `TestDistributedLockProvider` implementation with enhanced initialization and failure simulation.
- Reorganized tests for transient acquisition/release failures to use parameterized `Theory` for improved maintainability.

* Refactor transient exception handling: rename interfaces and classes for consistency, update references across codebase, and improve code readability.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Simplify WorkflowServer setup and DistributedLockResilienceTests by replacing IDistributedLockProvider with TestDistributedLockProvider.

* Remove unused `using` directives in unit tests to improve code cleanliness.

* Remove `TransientExceptionTypes` helper and inline its usage in tests for improved maintainability.

* Add descriptive `DisplayName` attributes to unit tests for improved test clarity.

* Fix redundant exception checking in TransientExceptionDetector (#7162)

* Initial plan

* Fix redundant exception checking in TransientExceptionDetector

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Extract MaxRetryAttempts constant in DistributedLockResilienceTests (#7164)

* Initial plan

* Extract MaxRetryAttempts constant to eliminate hardcoded magic number

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Make TestDistributedLockProvider thread-safe with Interlocked operations (#7163)

* Initial plan

* Make TestDistributedLockProvider thread-safe using Interlocked operations

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowClient.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/component/Elsa.Workflows.ComponentTests/Scenarios/DistributedLockResilience/DistributedLockResilienceTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowClient.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Resilience.Core/Services/DefaultTransientExceptionStrategy.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Include `CancellationToken` in distributed lock handling methods for improved cancellation support.

* Initial plan (#7168)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Cache detector list in TransientExceptionDetector to avoid repeated allocations (#7167)

* Initial plan

* Cache detector list in field to avoid repeated allocations

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Use IReadOnlyList instead of List for better intent expression

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Fix TestDistributedLockProvider registration to properly decorate IDistributedLockProvider (#7166)

* Initial plan

* Fix TestDistributedLockProvider registration to use Decorate pattern and fix variable reference bug

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add runtime check for TestDistributedLockProvider registration

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Refactor `DistributedWorkflowClient` to simplify `Lazy<ResiliencePipeline>` initialization.

* Add integration tests for DistributedWorkflowClient lock resilience (#7165)

* Initial plan

* Fix compilation error: use correct parameter name transientExceptionDetector

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Add integration tests for DistributedWorkflowClient lock resilience

- Add SimpleWorkflow for testing distributed lock scenarios
- Add tests exercising RunInstanceAsync with transient lock failures
- Verify retry logic works correctly with actual workflow execution
- Test both acquisition and release failure scenarios
- Decorate IDistributedLockProvider to use TestDistributedLockProvider

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

* Address code review feedback

- Add explanatory comment for TestDistributedLockProvider cast
- Remove unnecessary blank line for consistent formatting

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* Simplify transient exception strategy by refactoring message pattern matching logic.

* Enhance distributed lock mock to support per-lock failure configuration and improve resilience tests.

* Refactor `TestDistributedLockProvider` to streamline failure handling logic and improve code clarity.

* Remove unused methods and redundant test case from `DistributedLockResilienceTests`.

* Refactor `DistributedLockResilienceTests` to simplify workflow client creation, consolidate assertion logic, and remove redundant test cases.

* Format `ResilienceStrategyCatalogTests` by removing redundant line breaks in test setup.

* Refactor `TransientExceptionDetectorTests` to simplify test setup, consolidate test cases, and remove redundant logic.

* Handle `InvalidOperationException` in `XunitLogger` to suppress logging errors during inactive tests.

* Update workflows to use .NET 10 and adjust resilience tests project configuration.

* Refactor distributed runtime feature and integrations to improve resilience handling, configure services fluently, and add cancellation safeguards in background services.

* Update `base_version` to `3.7.0` in GitHub workflow configuration.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
2025-12-29 19:53:48 +01:00
..
ActivityNotificationsMiddleware Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
ActivityOutputs Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00
Blocking Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
BlockingAndBreaking Improves Fork activity and break signal handling (#7104) 2025-11-25 19:29:02 +01:00
CanExecute Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
Composites Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
CompositesAndOutcomes Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
CompositesPassingData Add unit and integration tests for SetOutput activity 2025-10-22 23:43:51 +02:00
DefaultActivityCommitStrategy Refactor commit strategy resolution for improved clarity and efficiency; remove unused example files and add a new CommitTracker helper for testing. 2025-12-16 08:01:49 -05:00
DefaultWorkflowCommitStrategy Clarify commit strategy fallback behavior in documentation; update test method signature for consistency 2025-12-16 08:01:49 -05:00
DependencyWorkflows Add integration tests for WorkflowDefinitionActivity scenarios (#6999) 2025-10-21 15:37:10 +02:00
DependencyWorkflowsPublishing Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
ExplicitJoins Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
FlowchartCompletion Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
FlowchartNextActivity Configures Flowchart Execution via DI (#7141) 2025-12-15 10:15:39 +01:00
HttpRequestWithLiquid Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
ImportAndExecute Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ImportAndPublish Create trigger payload validation, refacto HttpEndpoint validator and create Cron validator (#6641) 2025-05-20 19:52:43 +02:00
Incidents Addresses warnings and enforces null safety (#7051) 2025-11-12 16:56:31 +01:00
JavaScriptFunctions Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
JavaScriptListsAndArrays Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
JavaScriptNativeVariables Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
JoinBehaviors Configures Flowchart Execution via DI (#7141) 2025-12-15 10:15:39 +01:00
JsonObjectSerialization Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
JsonObjectToObjectRemainsJsonObject Update all dependencies to new projects. 2025-05-21 00:20:13 +01:00
ParentChildCompletion Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ParentChildInputs Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
ParentChildOutputMapping Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
RunAsynchronousActivityOutput Enhances distributed lock handling with resilience (#7161) 2025-12-29 19:53:48 +01:00
Serialization Addresses warnings and enforces null safety (#7051) 2025-11-12 16:56:31 +01:00
SetGetVariables Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00
SetGetVariablesArray Added IEnumerableTypeConverter (#7020) 2025-11-12 11:07:33 +01:00
SetGetVariablesFromActivities Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00
SmokeTests Adds integration tests for core activities (#7100) 2025-11-24 14:43:42 +01:00
TriggerIndexing Improves workflow deletion and task scheduling (#7088) 2025-11-21 20:58:38 +01:00
WorkflowCancellation Improved support for named workflow instances 2025-03-02 11:17:18 +01:00
WorkflowDefinitionActivities Add integration tests for WorkflowDefinitionActivity scenarios (#6999) 2025-10-21 15:37:10 +02:00
WorkflowDefinitionStorePopulation Add Elsa Script DSL (#7076) 2025-11-25 19:57:50 +01:00
WorkflowDispatchNotifications Replace flaky Task.Delay with TaskCompletionSource for deterministic test synchronization 2025-12-24 23:47:55 +00:00
WorkflowInstanceName Improved support for named workflow instances 2025-03-02 11:17:18 +01:00
WorkflowOutputMapping Refactor Workflow Runtimes (#5444) 2024-06-10 19:36:51 +02:00
WorkflowResults Refactor variable initialization for clarity and consistency 2025-03-13 21:05:28 +01:00