2023-10-10 10:34:32 +00:00
|
|
|
using Elsa.Extensions;
|
2024-04-19 19:57:55 +00:00
|
|
|
using Elsa.Workflows.Activities;
|
2024-03-30 20:22:35 +00:00
|
|
|
using Elsa.Workflows.Management.Options;
|
Add a more generic UIHandler to customize how inputAttributes can be handle by UI (#4688)
* add a more generic UIHandler to customize how inputAttributes can be handle by the ui
* Add IPropertyUIHandlerResolver and update PropertyUIHandlerResolver
Introduced a new interface, IPropertyUIHandlerResolver, to resolve UI options for a property. Refactored PropertyUIHandlerResolver to implement this interface and removed the unnecessary partial class structure. Also, cleaned up some unnecessary usings in various files for better code organization.
* Refactor variable name and description in InputDescriptor
The 'uISpecifications' variable in the InputDescriptor model is renamed to 'uiSpecifications' for better readability. Additionally, the associated comment was revised to explain that the dictionary is used by the UI.
* "Refactor codebase for improved organization and cleaner architecture"
The codebase has been significantly refactored, moving several classes to more appropriate namespaces for improved organization and cleaner architecture. This includes shifting UI hint handlers, activities, and memory-related components, amongst others. The changes should improve code readability and maintainability, but as this is a broad refactoring effort, thorough regression testing is advised.
* Add CheckList UIHint with associated handler and provider
This update introduces a new UIHint called CheckList to the Elsa.Workflows.Core. This includes the necessary handler and provider classes. The handler is registered in the WorkflowsFeature.cs, and the CheckList UIHint key has been added to the InputUIHints.cs. Various associated files have been created in both the Elsa.Api.Client and Elsa.Workflows.Core project to support this new UIHint.
---------
Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2023-12-26 17:56:29 +00:00
|
|
|
using Elsa.Workflows.Models;
|
2023-10-10 10:34:32 +00:00
|
|
|
using Elsa.Workflows.Runtime.Entities;
|
Add a more generic UIHandler to customize how inputAttributes can be handle by UI (#4688)
* add a more generic UIHandler to customize how inputAttributes can be handle by the ui
* Add IPropertyUIHandlerResolver and update PropertyUIHandlerResolver
Introduced a new interface, IPropertyUIHandlerResolver, to resolve UI options for a property. Refactored PropertyUIHandlerResolver to implement this interface and removed the unnecessary partial class structure. Also, cleaned up some unnecessary usings in various files for better code organization.
* Refactor variable name and description in InputDescriptor
The 'uISpecifications' variable in the InputDescriptor model is renamed to 'uiSpecifications' for better readability. Additionally, the associated comment was revised to explain that the dictionary is used by the UI.
* "Refactor codebase for improved organization and cleaner architecture"
The codebase has been significantly refactored, moving several classes to more appropriate namespaces for improved organization and cleaner architecture. This includes shifting UI hint handlers, activities, and memory-related components, amongst others. The changes should improve code readability and maintainability, but as this is a broad refactoring effort, thorough regression testing is advised.
* Add CheckList UIHint with associated handler and provider
This update introduces a new UIHint called CheckList to the Elsa.Workflows.Core. This includes the necessary handler and provider classes. The handler is registered in the WorkflowsFeature.cs, and the CheckList UIHint key has been added to the InputUIHints.cs. Various associated files have been created in both the Elsa.Api.Client and Elsa.Workflows.Core project to support this new UIHint.
---------
Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2023-12-26 17:56:29 +00:00
|
|
|
using Elsa.Workflows.State;
|
2024-03-30 20:22:35 +00:00
|
|
|
using Humanizer;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
2023-10-10 10:34:32 +00:00
|
|
|
|
Add Bookmark Queue and Restore Background Activity Execution (#5758)
* Update package versions and add PrivateAssets attributes
Updated multiple package versions to the latest releases and added the `PrivateAssets="All"` attribute to several dependencies to improve project isolation. This ensures that the specified packages will not be propagated as transitive dependencies.
* Fix incorrect serializer and generator references.
Replaced `_payloadSerializer` and `_identityGenerator` with `payloadSerializer` and `identityGenerator` respectively. This resolves potential null reference issues and ensures the correct instances are used during workflow and definition processing.
* Refactor background activity scheduling logic
Moved the state commit outside of the deferred task to ensure workflow state is saved before scheduling activities. This change ensures the workflow instance is updated promptly, preventing potential concurrency issues.
* Add bookmark queue management system
Introduced a comprehensive bookmark queue system to manage and process bookmarks efficiently. This includes entities, stores, filters, processors, and workers for both in-memory and distributed environments. Additionally, added notifications to signal bookmark queue workers and updated related contracts.
* Add state commit handler with various implementations
Introduced ICommitStateHandler for committing workflow state. Provided NoopCommitStateHandler and StoreCommitStateHandler implementations. Updated namespaces and dependencies across the project to incorporate these changes.
* Fix order in CommitAsync method for proper task execution
Reorder `ExecuteDeferredTasksAsync` after `SaveAsync` in `CommitAsync` method to ensure that deferred tasks execute correctly after the state is saved, addressing potential issues with task execution dependencies.
* Remove unused and deprecated middleware and annotations
Deleted unused classes `ExecuteDeferredActivityTasks` and `ScheduleBackgroundActivitiesMiddleware`. Removed unnecessary summary tags and unused usings across multiple files to clean up the codebase.
* Remove unnecessary initial migration files
Deleted initial migration files for alterations, management, and identity contexts. These files are no longer needed and their removal helps keep the repository clean and maintainable.
* Add delay in TriggerBookmarkQueueWorker loop
Introduced a 10-second delay within the while loop of TriggerBookmarkQueueWorker. This change aims to alleviate potential tight loop issues, ensuring better performance and resource management.
* Enable all database providers in migration script
Uncomment the providers array and add previously commented database providers (SqlServer, Sqlite, PostgreSql, Oracle). This ensures compatibility with multiple database systems during the migration process.
* Remove unused Microsoft.Extensions.DependencyInjection import
The import statement for `Microsoft.Extensions.DependencyInjection` was not being utilized and has been removed. This cleanup helps in maintaining cleaner and more readable code without unnecessary imports.
* Add Dapper persistence support for bookmark queue
Introduced a new Dapper-based bookmark queue store and related classes for handling bookmark queue items. Various migrations were added to support the new `BookmarkQueueItems` table with tenant-specific columns. Refactored existing EF Core and in-memory bookmark queue item stores to use a unified interface.
* Add MongoBookmarkQueueStore implementation
Added a MongoDB-based BookmarkQueueStore to handle CRUD operations for bookmark queue items. Updated the workflow runtime persistence feature to include and utilize this new store for managing bookmark queue items.
* Add migration helper for altering columns and update keys
Introduced MigrationHelper to simplify altering DateTime and Boolean columns. Updated keys in KeyValueStore and KeyValueFilter classes to use 'Id' instead of 'Key'. Revised migration scripts to utilize the new helper methods for modifying column types.
* Prevent BookmarkQueueWorker.Stop from cancelling when not running
Previously, the Stop method would always cancel the token source regardless of the worker's state. By checking if the worker is running before cancelling, we avoid unnecessary operations and potential errors related to an already cancelled token source.
* Update database schema and bookmark handling logic
Refactored various database migration scripts to allow nullable `WorkflowInstanceId` fields and added new fields such as `ActivityInstanceId` and `CorrelationId`. Enhanced bookmark queue and bound workflow handling logic to support these new fields, ensuring precise and efficient workflow execution and queuing.
* Refactor BookmarkHash to StimulusHash and introduce ActivityTypeName
Renamed BookmarkHash to StimulusHash across multiple components and added ActivityTypeName to enhance traceability. Updated indices, filters, and entities for this change, ensuring consistent naming and improved functionality.
* Remove unnecessary timeouts in AzureServiceBusTests.
Eliminated redundant timeout parameters in _signalManager.WaitAsync calls to streamline test execution and reduce potential waiting time. This change ensures more efficient and accurate testing synchronization.
* Rename and refactor BookmarkQueueWorkerSignaler
Renamed IBookmarkQueueWorkerSignaler to IBookmarkQueueSignaler across the project for clarity. Updated related classes and methods to reflect this change. Added bookmark queue signaling to ensure new items are processed, and renamed BookmarkQueueStore to EFBookmarkQueueStore for consistency.
* Refactor EF Core stores and add migration field
Refactored EF Core store classes to simplify field usage and constructors. Added "CorrelationId" field and created corresponding index in SQLite and PostgreSQL migration files to support new functionality.
* Update workflow context ID and optimize Task handling
Added `ParentInstanceId` to `BulkDispatchWorkflowsStimulus` for context propagation. Also, reset `TaskCompletionSource` in `BookmarkQueueSignaler` to reduce memory usage and ensure proper task lifecycle management.
* Update async method signature and fix variable usage
Modified `AddAsync` to include the `OnSaveAsync` parameter. Corrected the variable used for `parentInstanceId` and utilized `ActivityTypeNameHelper` for generating type names.
* Reset migrations to 3.2
* Generate 3.3 migrations
2024-07-15 20:37:14 +00:00
|
|
|
namespace Elsa.Workflows.Runtime;
|
2023-10-10 10:34:32 +00:00
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
2024-04-12 13:00:00 +00:00
|
|
|
public class DefaultActivityExecutionMapper(IOptions<ManagementOptions> options) : IActivityExecutionMapper
|
|
|
|
|
{
|
|
|
|
|
private const string LogPersistenceModeKey = "logPersistenceMode";
|
|
|
|
|
|
2023-10-10 10:34:32 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public ActivityExecutionRecord Map(ActivityExecutionContext source)
|
2024-04-12 13:00:00 +00:00
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* {
|
|
|
|
|
* "logPersistenceMode": {
|
|
|
|
|
* "default": "default",
|
|
|
|
|
* "inputs": { k : v },
|
|
|
|
|
* "outputs": { k: v }
|
|
|
|
|
* }
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
|
2024-04-19 19:57:55 +00:00
|
|
|
var workflow = (Workflow?)source.GetAncestors().FirstOrDefault(x => x.Activity is Workflow)?.Activity ?? source.WorkflowExecutionContext.Workflow;
|
|
|
|
|
var workflowPersistenceProperty = GetDefaultPersistenceMode(workflow.CustomProperties, () => options.Value.LogPersistenceMode);
|
2024-04-12 13:00:00 +00:00
|
|
|
var activityPersistenceProperties = source.Activity.CustomProperties.GetValueOrDefault<IDictionary<string, object?>>(LogPersistenceModeKey, () => new Dictionary<string, object?>());
|
|
|
|
|
var activityPersistencePropertyDefault = GetDefaultPersistenceMode(source.Activity.CustomProperties, () => workflowPersistenceProperty);
|
|
|
|
|
|
2023-10-10 10:34:32 +00:00
|
|
|
// Get any outcomes that were added to the activity execution context.
|
2023-10-13 08:34:21 +00:00
|
|
|
var outcomes = source.JournalData.TryGetValue("Outcomes", out var resultValue) ? resultValue as string[] : default;
|
|
|
|
|
var payload = new Dictionary<string, object>();
|
|
|
|
|
|
|
|
|
|
if (outcomes != null)
|
|
|
|
|
payload.Add("Outcomes", outcomes);
|
|
|
|
|
|
|
|
|
|
// Get any outputs that were added to the activity execution context.
|
|
|
|
|
var activity = source.Activity;
|
|
|
|
|
var expressionExecutionContext = source.ExpressionExecutionContext;
|
|
|
|
|
var activityDescriptor = source.ActivityDescriptor;
|
|
|
|
|
var outputDescriptors = activityDescriptor.Outputs;
|
|
|
|
|
|
|
|
|
|
var outputs = outputDescriptors.ToDictionary(x => x.Name, x =>
|
|
|
|
|
{
|
|
|
|
|
if (x.IsSerializable == false)
|
|
|
|
|
return "(not serializable)";
|
|
|
|
|
|
|
|
|
|
var cachedValue = activity.GetOutput(expressionExecutionContext, x.Name);
|
|
|
|
|
|
|
|
|
|
if (cachedValue != default)
|
|
|
|
|
return cachedValue;
|
|
|
|
|
|
|
|
|
|
if (x.ValueGetter(activity) is Output output && source.TryGet(output.MemoryBlockReference(), out var outputValue))
|
|
|
|
|
return outputValue;
|
|
|
|
|
|
|
|
|
|
return default;
|
|
|
|
|
});
|
2024-04-12 13:00:00 +00:00
|
|
|
|
|
|
|
|
outputs = StorePropertyUsingPersistenceMode(outputs, activityPersistenceProperties!.GetValueOrDefault("outputs", () => new Dictionary<string, object>())!, activityPersistencePropertyDefault);
|
|
|
|
|
var activityState = StorePropertyUsingPersistenceMode(source.ActivityState, activityPersistenceProperties!.GetValueOrDefault("inputs", () => new Dictionary<string, object>())!, activityPersistencePropertyDefault);
|
|
|
|
|
|
2023-10-13 08:34:21 +00:00
|
|
|
return new ActivityExecutionRecord
|
|
|
|
|
{
|
|
|
|
|
Id = source.Id,
|
|
|
|
|
ActivityId = source.Activity.Id,
|
2023-10-25 20:46:06 +00:00
|
|
|
ActivityNodeId = source.NodeId,
|
2023-10-13 08:34:21 +00:00
|
|
|
WorkflowInstanceId = source.WorkflowExecutionContext.Id,
|
|
|
|
|
ActivityType = source.Activity.Type,
|
|
|
|
|
ActivityName = source.Activity.Name,
|
2024-03-30 20:22:35 +00:00
|
|
|
ActivityState = activityState,
|
2023-10-13 08:34:21 +00:00
|
|
|
Outputs = outputs,
|
2024-03-08 07:54:08 +00:00
|
|
|
Properties = source.Properties,
|
2023-10-13 08:34:21 +00:00
|
|
|
Payload = payload,
|
|
|
|
|
Exception = ExceptionState.FromException(source.Exception),
|
|
|
|
|
ActivityTypeVersion = source.Activity.Version,
|
|
|
|
|
StartedAt = source.StartedAt,
|
|
|
|
|
HasBookmarks = source.Bookmarks.Any(),
|
|
|
|
|
Status = GetAggregateStatus(source),
|
|
|
|
|
CompletedAt = source.CompletedAt
|
|
|
|
|
};
|
2024-04-12 13:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static LogPersistenceMode GetDefaultPersistenceMode(IDictionary<string, object> customProperties, Func<LogPersistenceMode> defaultFactory)
|
|
|
|
|
{
|
|
|
|
|
var properties = customProperties.GetValueOrDefault<IDictionary<string, object?>>(LogPersistenceModeKey, () => new Dictionary<string, object?>());
|
|
|
|
|
var persistencePropertyDefault = properties!.GetValueOrDefault("default", defaultFactory);
|
|
|
|
|
|
Add Component Testing Framework (#5261)
* Add application component tests
Multiple new test files were added to deliver application component tests. This move improves testing by adding integration tests that cover overall system behavior and checking end-to-end actions. Ensuring the system functions correctly as a whole. In the process, updating some package versions to maintain compatibility.
* Add RefitSettings helper and revise API client service configuration
The commit introduces a 'RefitSettingsHelper' for Elsa API client and revises the way the API client services are configured. It also makes improvements to the WorkflowServerTestWebAppFactory for component testing. Some endpoint contracts related to workflow execution are also updated to have optional parameters.
* Remove old tests and add new workflow tests
This commit removes old, unnecessary tests and incorporates new workflow tests. It also improves the Elsa API client JSON serializer and adds a helper for HttpResponseMessage. Lastly, the commit introduces changes to properly configure the test logging and to manage application settings.
* Add HttpHelloWorld workflow tests
A new component test scenario, HttpHelloWorldTests, has been created for testing an HttpHelloWorld workflow. This involves asserting if a workflow responds correctly with "Hello World". Furthermore, an HTTP workflow client has been introduced in the WorkflowServerTestWebAppFactory class to provide a base address for workflow API calls.
* Add new test file and update workflow execution tests
This change adds a new test file "fork-1.json" to the Elsa.Workflows.Api.ComponentTests project. Also, updates were made throughout the tests to replace the WorkflowServerTestWebAppFactory with a fixture, allowing the tests to run in parallel. Lastly, unnecessary warning suppression was removed from the Elsa.Workflows.Core extension method.
* Add filter for .json and .elsa files in BlobStorageWorkflowProvider
This change adds a BrowseFilter in the BlobStorageWorkflowProvider options. This filter checks for files that end with .json or .elsa and includes only these files when browsing through the blob storage. This filter helps prioritize specific workflow file types.
* Rename WorkflowServerTestWebAppFactoryFixture and update usage
The old class name "WorkflowServerTestWebAppFactoryFixture" has been replaced with the more accurate "WorkflowServerWebAppFactoryFixture". All references to the previous name in other classes were also updated accordingly. In addition, the directory key in the method "CreateConvoyOptionsBuilder" has been updated from "Workflows" to "Scenarios".
* Update test fixture in workflow tests
The commit updates the test fixture in two test classes: HttpHelloWorldTests and HelloWorldTests. The former test fixture, WorkflowServerTestWebAppFactoryFixture, was replaced by WorkflowServerWebAppFactoryFixture to accurately match the testing needs.
* Update .csproj file paths and reorganize tests
The commit modifies the file paths for several test scenario files in the Elsa.Workflows.Api.ComponentTests.csproj, reflecting a reorganization of the tests. Previously static paths have been updated to new paths under 'Scenarios'. Additionally, two new test files related to 'LogPersistenceModes' have been included in the project.
* Add tests for log persistence modes
This commit introduces two new test scenarios for logging persistence modes and includes a related test called 'HelloWorldWorkflow'. These tests cover scenarios where certain workflow inputs should be stored and others shouldn't, thereby testing the log persistence feature. This ensures that the logging behavior respects the specified persistence mode.
* Add log persistence tests and update LogPersistenceMode enum
The commit contains the addition of new log persistence tests for verifying correctness of log persistence behavior. Furthermore, the LogPersistenceMode enum has been updated, replacing 'Default' with 'Inherit'. This change makes the mode's purpose clearer. Lastly, new test scenarios and test data files were added for more comprehensive testing.
* Remove obsolete component tests and support files
The files removed are no longer necessary for the current state of the application. They include various component tests and their related support files within the Elsa.Workflows.Api.ComponentTests project. By removing these, the project structure is cleaner and only contains relevant tests.
* Add dispatch workflow scenario tests and necessary helper classes
This commit includes two new tests for dispatching workflows, along with the creation of new 'ChildWorkflow' and 'DispatchAndWaitWorkflow' classes. Auxiliary helpers and services have been added to aid in managing workflow events and signals for these tests. The 'ComponentTest' has also been upgraded to support disposal handling.
* Remove ITestOutputHelper dependency from test classes
Removed the dependency on ITestOutputHelper in multiple test classes across various workflow scenarios. This change simplifies the test class constructors by reducing the number of required dependencies, contributing to cleaner and leaner code.
* Add 'Hello World' scenario to WorkflowCompletion tests
The 'Hello World' scenario was moved into WorkflowCompletion tests, along with changes in workflow definition identifiers. As part of these changes, the 'hello-world.json' file was updated; a new file under the same name was created in the WorkflowCompletion area and the workflow identifiers in basic and workflow completion tests were updated accordingly. Additionally, 'fork-1.json' has been renamed to 'fork.json'.
* Add support for cluster hosting tests
This commit introduces a suite of integration tests designed to validate the behaviour of hosting multiple instances of Elsa in a clustered environment. These tests simulate a typical clustered hosting scenario by using 'App', 'Cluster', and 'Infrastructure' objects to emulate different instances of the Elsa workflow engine running on separate servers. Name changes were made to certain classes and methods to reflect their new scopes and roles within the testing environment.
* Add performance tests and improve component tests
Added a new performance tests project scaffold, complete with its own project file, build properties file, and a dummy test. Updated component tests to improve multi-pod testing, primarily through the addition of additional service scopes and asserting activity registry synchronization. These changes also required updates to existing project and props files as well as the solution file.
* Update ActivityRegistrySyncTests and Infrastructure
Added a reference to Services in ActivityRegistrySyncTests and removed unnecessary whitespace in both files. The test component Elsa.Workflows has been modified to import newly added services, ensuring all tests are running with the expected resources and services.
* Fix comment
* Add NOOP implementations for stores
* Update PostgreSQL image and adjust test timings
The PostgreSQL image used for testing has been updated to the latest version from 13.3-alpine. Timeouts in ISignalManager and DispatchWorkflowsTests have been reduced for efficiency. A delay in the ChildWorkflow has also been decreased. Additionally, an 'ImportWorkflowActivity' test in ActivityRegistrySyncTests has been marked as not yet implemented.
2024-04-26 13:49:14 +00:00
|
|
|
if (persistencePropertyDefault == LogPersistenceMode.Inherit)
|
2024-04-12 13:00:00 +00:00
|
|
|
return defaultFactory();
|
|
|
|
|
return persistencePropertyDefault;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Dictionary<string, object?> StorePropertyUsingPersistenceMode(IDictionary<string, object?> inputs,
|
|
|
|
|
IDictionary<string, object> persistenceModeConfiguration,
|
|
|
|
|
LogPersistenceMode defaultLogPersistenceMode)
|
|
|
|
|
{
|
|
|
|
|
var result = new Dictionary<string, object?>();
|
|
|
|
|
|
|
|
|
|
foreach (var input in inputs)
|
|
|
|
|
{
|
|
|
|
|
var persistence = persistenceModeConfiguration.GetValueOrDefault(input.Key.Camelize(), () => defaultLogPersistenceMode);
|
|
|
|
|
if (persistence.Equals(LogPersistenceMode.Include)
|
Add Component Testing Framework (#5261)
* Add application component tests
Multiple new test files were added to deliver application component tests. This move improves testing by adding integration tests that cover overall system behavior and checking end-to-end actions. Ensuring the system functions correctly as a whole. In the process, updating some package versions to maintain compatibility.
* Add RefitSettings helper and revise API client service configuration
The commit introduces a 'RefitSettingsHelper' for Elsa API client and revises the way the API client services are configured. It also makes improvements to the WorkflowServerTestWebAppFactory for component testing. Some endpoint contracts related to workflow execution are also updated to have optional parameters.
* Remove old tests and add new workflow tests
This commit removes old, unnecessary tests and incorporates new workflow tests. It also improves the Elsa API client JSON serializer and adds a helper for HttpResponseMessage. Lastly, the commit introduces changes to properly configure the test logging and to manage application settings.
* Add HttpHelloWorld workflow tests
A new component test scenario, HttpHelloWorldTests, has been created for testing an HttpHelloWorld workflow. This involves asserting if a workflow responds correctly with "Hello World". Furthermore, an HTTP workflow client has been introduced in the WorkflowServerTestWebAppFactory class to provide a base address for workflow API calls.
* Add new test file and update workflow execution tests
This change adds a new test file "fork-1.json" to the Elsa.Workflows.Api.ComponentTests project. Also, updates were made throughout the tests to replace the WorkflowServerTestWebAppFactory with a fixture, allowing the tests to run in parallel. Lastly, unnecessary warning suppression was removed from the Elsa.Workflows.Core extension method.
* Add filter for .json and .elsa files in BlobStorageWorkflowProvider
This change adds a BrowseFilter in the BlobStorageWorkflowProvider options. This filter checks for files that end with .json or .elsa and includes only these files when browsing through the blob storage. This filter helps prioritize specific workflow file types.
* Rename WorkflowServerTestWebAppFactoryFixture and update usage
The old class name "WorkflowServerTestWebAppFactoryFixture" has been replaced with the more accurate "WorkflowServerWebAppFactoryFixture". All references to the previous name in other classes were also updated accordingly. In addition, the directory key in the method "CreateConvoyOptionsBuilder" has been updated from "Workflows" to "Scenarios".
* Update test fixture in workflow tests
The commit updates the test fixture in two test classes: HttpHelloWorldTests and HelloWorldTests. The former test fixture, WorkflowServerTestWebAppFactoryFixture, was replaced by WorkflowServerWebAppFactoryFixture to accurately match the testing needs.
* Update .csproj file paths and reorganize tests
The commit modifies the file paths for several test scenario files in the Elsa.Workflows.Api.ComponentTests.csproj, reflecting a reorganization of the tests. Previously static paths have been updated to new paths under 'Scenarios'. Additionally, two new test files related to 'LogPersistenceModes' have been included in the project.
* Add tests for log persistence modes
This commit introduces two new test scenarios for logging persistence modes and includes a related test called 'HelloWorldWorkflow'. These tests cover scenarios where certain workflow inputs should be stored and others shouldn't, thereby testing the log persistence feature. This ensures that the logging behavior respects the specified persistence mode.
* Add log persistence tests and update LogPersistenceMode enum
The commit contains the addition of new log persistence tests for verifying correctness of log persistence behavior. Furthermore, the LogPersistenceMode enum has been updated, replacing 'Default' with 'Inherit'. This change makes the mode's purpose clearer. Lastly, new test scenarios and test data files were added for more comprehensive testing.
* Remove obsolete component tests and support files
The files removed are no longer necessary for the current state of the application. They include various component tests and their related support files within the Elsa.Workflows.Api.ComponentTests project. By removing these, the project structure is cleaner and only contains relevant tests.
* Add dispatch workflow scenario tests and necessary helper classes
This commit includes two new tests for dispatching workflows, along with the creation of new 'ChildWorkflow' and 'DispatchAndWaitWorkflow' classes. Auxiliary helpers and services have been added to aid in managing workflow events and signals for these tests. The 'ComponentTest' has also been upgraded to support disposal handling.
* Remove ITestOutputHelper dependency from test classes
Removed the dependency on ITestOutputHelper in multiple test classes across various workflow scenarios. This change simplifies the test class constructors by reducing the number of required dependencies, contributing to cleaner and leaner code.
* Add 'Hello World' scenario to WorkflowCompletion tests
The 'Hello World' scenario was moved into WorkflowCompletion tests, along with changes in workflow definition identifiers. As part of these changes, the 'hello-world.json' file was updated; a new file under the same name was created in the WorkflowCompletion area and the workflow identifiers in basic and workflow completion tests were updated accordingly. Additionally, 'fork-1.json' has been renamed to 'fork.json'.
* Add support for cluster hosting tests
This commit introduces a suite of integration tests designed to validate the behaviour of hosting multiple instances of Elsa in a clustered environment. These tests simulate a typical clustered hosting scenario by using 'App', 'Cluster', and 'Infrastructure' objects to emulate different instances of the Elsa workflow engine running on separate servers. Name changes were made to certain classes and methods to reflect their new scopes and roles within the testing environment.
* Add performance tests and improve component tests
Added a new performance tests project scaffold, complete with its own project file, build properties file, and a dummy test. Updated component tests to improve multi-pod testing, primarily through the addition of additional service scopes and asserting activity registry synchronization. These changes also required updates to existing project and props files as well as the solution file.
* Update ActivityRegistrySyncTests and Infrastructure
Added a reference to Services in ActivityRegistrySyncTests and removed unnecessary whitespace in both files. The test component Elsa.Workflows has been modified to import newly added services, ensuring all tests are running with the expected resources and services.
* Fix comment
* Add NOOP implementations for stores
* Update PostgreSQL image and adjust test timings
The PostgreSQL image used for testing has been updated to the latest version from 13.3-alpine. Timeouts in ISignalManager and DispatchWorkflowsTests have been reduced for efficiency. A delay in the ChildWorkflow has also been decreased. Additionally, an 'ImportWorkflowActivity' test in ActivityRegistrySyncTests has been marked as not yet implemented.
2024-04-26 13:49:14 +00:00
|
|
|
|| (persistence.Equals(LogPersistenceMode.Inherit) && defaultLogPersistenceMode is LogPersistenceMode.Include or LogPersistenceMode.Inherit))
|
2024-04-12 13:00:00 +00:00
|
|
|
result.Add(input.Key, input.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-10 10:34:32 +00:00
|
|
|
private ActivityStatus GetAggregateStatus(ActivityExecutionContext context)
|
|
|
|
|
{
|
|
|
|
|
// If any child activity is faulted, the aggregate status is faulted.
|
|
|
|
|
var descendantContexts = context.GetDescendants().ToList();
|
2023-10-13 08:34:21 +00:00
|
|
|
|
2023-10-10 10:34:32 +00:00
|
|
|
if (descendantContexts.Any(x => x.Status == ActivityStatus.Faulted))
|
|
|
|
|
return ActivityStatus.Faulted;
|
|
|
|
|
|
|
|
|
|
return context.Status;
|
|
|
|
|
}
|
|
|
|
|
}
|