add integration test flows - #16
Conversation
There was a problem hiding this comment.
Sorry @yilmaztayfun, your pull request is larger than the review limit of 150000 diff characters
|
Important Review skippedToo many files! This PR contains 175 files, which is 25 over the limit of 150. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (175)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive suite of integration tests for the core domain, covering lifecycle transitions, subflow orchestration, task execution, error boundaries, schema validation, and version consistency. The changes include new workflow definitions, C# mapping scripts, Dapr component configurations, and Postman collections. I have identified several issues: the Target Framework Moniker in the test project is invalid, there is a redundant block in the .gitignore file, and several request names in the Postman collections are either truncated or duplicated. Additionally, I have suggested refactoring the duplicated property-copying logic in the C# mapping scripts and removing unnecessary async modifiers from methods that do not perform asynchronous operations.
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> |
|
|
||
| # vnext-forge LSP scaffold | ||
| .vnext-forge-lsp/ |
| "name": "TEST 4: Instance data endpoint", | ||
| "item": [ | ||
| { | ||
| "name": "GET {{baseUrl}}/api/v{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{in", |
There was a problem hiding this comment.
The name for this Postman request appears to be truncated. This can make it difficult to identify the request's purpose in the Postman UI. Consider providing a full, descriptive name, for example, "Get instance data".
| "name": "GET {{baseUrl}}/api/v{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{in", | |
| "name": "Get instance data", |
| "response": [] | ||
| }, | ||
| { | ||
| "name": "TEST 3 — Step 6: Final state and merged data", |
There was a problem hiding this comment.
This request name, "TEST 3 — Step 6: Final state and merged data", is a duplicate of the previous one. To improve clarity in the Postman collection, consider giving it a more specific name, such as "TEST 3 — Step 7: Verify final data", to distinguish it from the state verification request.
| "name": "TEST 3 — Step 6: Final state and merged data", | |
| "name": "TEST 3 — Step 7: Verify final data", |
| }, | ||
| "mapping": { | ||
| "location": "./src/DaprHttpMapping.csx", | ||
| "code": "dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRHluYW1pYzsKdXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKdXNpbmcgQkJULldvcmtmbG93LlNjcmlwdGluZzsKdXNpbmcgQkJULldvcmtmbG93LkRlZmluaXRpb25zOwoKcHVibGljIGNsYXNzIERhcHJIdHRwTWFwcGluZyA6IFNjcmlwdEJhc2UsIElNYXBwaW5nCnsKICAgIHB1YmxpYyBUYXNrPFNjcmlwdFJlc3BvbnNlPiBJbnB1dEhhbmRsZXIoV29ya2Zsb3dUYXNrIHRhc2ssIFNjcmlwdENvbnRleHQgY29udGV4dCkKICAgIHsKICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KG5ldyBTY3JpcHRSZXNwb25zZSgpKTsKICAgIH0KCiAgICBwdWJsaWMgVGFzazxTY3JpcHRSZXNwb25zZT4gT3V0cHV0SGFuZGxlcihTY3JpcHRDb250ZXh0IGNvbnRleHQpCiAgICB7CiAgICAgICAgdmFyIGRhdGEgPSBjb250ZXh0Lkluc3RhbmNlLkRhdGE7CiAgICAgICAgZHluYW1pYyByZXN1bHQgPSBuZXcgRXhwYW5kb09iamVjdCgpOwoKICAgICAgICBpZiAoSGFzUHJvcGVydHkoZGF0YSwgInRlc3RJZCIpKSByZXN1bHQudGVzdElkID0gZGF0YS50ZXN0SWQ7CiAgICAgICAgaWYgKEhhc1Byb3BlcnR5KGRhdGEsICJpbml0Q29tcGxldGVkIikpIHJlc3VsdC5pbml0Q29tcGxldGVkID0gZGF0YS5pbml0Q29tcGxldGVkOwoKICAgICAgICByZXN1bHQudGFza1Jlc3VsdHMgPSBuZXcgRXhwYW5kb09iamVjdCgpOwogICAgICAgIGlmIChIYXN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udGFza1Jlc3VsdHMuZGFwckh0dHAuZXhlY3V0ZWRBdCA9IERhdGVUaW1lLlV0Y05vdy5Ub1N0cmluZygibyIpOwoKICAgICAgICB2YXIgdGFza1Jlc3BvbnNlID0gY29udGV4dC5Cb2R5OwogICAgICAgIGlmICh0YXNrUmVzcG9uc2UgIT0gbnVsbCAmJiBIYXNQcm9wZXJ0eSh0YXNrUmVzcG9uc2UsICJkYXRhIikpCiAgICAgICAgewogICAgICAgICAgICB2YXIgcmVzcG9uc2VEYXRhID0gdGFza1Jlc3BvbnNlLmRhdGE7CiAgICAgICAgICAgIGlmIChyZXNwb25zZURhdGEgIT0gbnVsbCAmJiBIYXNQcm9wZXJ0eShyZXNwb25zZURhdGEsICJwcm9jZXNzSWQiKSkKICAgICAgICAgICAgICAgIHJlc3VsdC50YXNrUmVzdWx0cy5kYXBySHR0cC5wcm9jZXNzSWQgPSByZXNwb25zZURhdGEucHJvY2Vzc0lkOwogICAgICAgIH0KCiAgICAgICAgTG9nSW5mb3JtYXRpb24oIkRhcHJIdHRwTWFwcGluZyBjb21wbGV0ZWQiKTsKICAgICAgICByZXR1cm4gVGFzay5Gcm9tUmVzdWx0KG5ldyBTY3JpcHRSZXNwb25zZSB7IERhdGEgPSByZXN1bHQgfSk7CiAgICB9Cn0K" |
There was a problem hiding this comment.
The C# code in this mapping, and several others in this file (DaprServiceMapping, DaprBindingMapping, etc.), contains duplicated logic for copying properties from data.taskResults to result.taskResults. This makes the code hard to maintain, as adding a new task would require updating many mapping files.
Consider refactoring this into a helper method to copy all properties from the source object to the destination. This would make the code more concise and maintainable.
For example, you could add a helper in ScriptBase:
protected void CopyProperties(dynamic source, dynamic destination)
{
var sourceDict = (IDictionary<string, object>)source;
var destDict = (IDictionary<string, object>)destination;
foreach (var kvp in sourceDict)
{
destDict[kvp.Key] = kvp.Value;
}
}Then, the OutputHandler can be simplified to copy all existing properties before adding the new one.
| ], | ||
| "rule": { | ||
| "location": "./src/TestPathPassRule.csx", | ||
| "code": "dXNpbmcgU3lzdGVtLlRocmVhZGluZy5UYXNrczsKdXNpbmcgQkJULldvcmtmbG93LlNjcmlwdGluZzsKCnB1YmxpYyBjbGFzcyBUZXN0UGF0aFBhc3NSdWxlIDogU2NyaXB0QmFzZSwgSUNvbmRpdGlvbk1hcHBpbmcKewogICAgcHVibGljIGFzeW5jIFRhc2s8Ym9vbD4gSGFuZGxlcihTY3JpcHRDb250ZXh0IGNvbnRleHQpCiAgICB7CiAgICAgICAgdmFyIGRhdGEgPSBjb250ZXh0Lkluc3RhbmNlPy5EYXRhOwogICAgICAgIGlmIChkYXRhID09IG51bGwpCiAgICAgICAgewogICAgICAgICAgICBMb2dJbmZvcm1hdGlvbigiVGVzdFBhdGhQYXNzUnVsZTogZGF0YSBpcyBudWxsLCByZXR1cm5pbmcgZmFsc2UiKTsKICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgIH0KCiAgICAgICAgaWYgKEhhc1Byb3BlcnR5KGRhdGEsICJ0ZXN0UGF0aCIpKQogICAgICAgIHsKICAgICAgICAgICAgdmFyIHRlc3RQYXRoID0gZGF0YS50ZXN0UGF0aD8uVG9TdHJpbmcoKTsKICAgICAgICAgICAgdmFyIHJlc3VsdCA9IHRlc3RQYXRoID09ICJwYXNzIjsKICAgICAgICAgICAgTG9nSW5mb3JtYXRpb24oJCJUZXN0UGF0aFBhc3NSdWxlOiB0ZXN0UGF0aD17dGVzdFBhdGh9LCByZXN1bHQ9e3Jlc3VsdH0iKTsKICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKICAgICAgICB9CgogICAgICAgIExvZ0luZm9ybWF0aW9uKCJUZXN0UGF0aFBhc3NSdWxlOiB0ZXN0UGF0aCBub3QgZm91bmQsIHJldHVybmluZyBmYWxzZSIpOwogICAgICAgIHJldHVybiBmYWxzZTsKICAgIH0KfQo=" |
There was a problem hiding this comment.
The Handler method in this C# script is marked as async but doesn't use the await keyword. This creates an unnecessary state machine, which can have a minor performance impact. For methods that can return a completed task synchronously, it's more efficient to return Task.FromResult() directly and remove the async keyword.
This pattern appears in several other rule and mapping scripts in this pull request (e.g., TestPathFailRule, ShortTimerMapping, AlwaysTrueRule).
Example:
// Before
public async Task<bool> Handler(ScriptContext context)
{
return true;
}
// After
public Task<bool> Handler(ScriptContext context)
{
return Task.FromResult(true);
}
No description provided.