-
Notifications
You must be signed in to change notification settings - Fork 755
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
[Bug]: Tests Passing Locally but Failing on GitHub Actions #43730
Comments
This is an assertion failure, where the expected output is different from the actual one.It looks like the error is not from the test framework side. At the point of assertion, the values are not similar. My hunch is that this difference arises due to the carriage return differences in UNIX v windows platforms. You will have to check where this difference is arising from, in the source code. I will close this issue since the root cause is not likely to be from the test framework side. We can re-open if necessary. |
This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now. |
If you inspect the test log at[1], it's clear that the expected and the actual strings are similar. Following is one example for your reference.
From the source code, it's just a string assertion[2]. So ideally this should work irrespective of whether you are working on a Unix or a windows platform. This could be some issue how the assertion works in the Ballerina side and is something that needs to figured out from the Ballerina team not from the developer. Please consider this as a high priority issue as this is impacting our release deadlines. [1] https://github.com/ballerina-platform/module-ballerinax-financial.iso20022-to-swiftmt/actions/runs/12594006933/job/35100844445?pr=5 |
Hi @RivinduM, I dabbled with test code of your project, and here are my observations. The string equality between the expected and the actual strings also returns false (actual == expected => false). This means we either have a bug in the equality check or there are characters not visible to the naked eye in either of the strings. What worked for me was normalizing the actual output for carriage return values. It turns out that Replacing the carriage return with \n would be an adequate workaround until then. string actual = check swiftmt:getFinMessage(check toSwiftMtMessage(inputXml, "101"));
regexp:RegExp regex = re `\r\n`;
string actualNormalized = regex.replaceAll(actual, "\n");
test:assertEquals(actualNormalized, expected, msg = "testToIso20022Xml result incorrect"); |
The issue is not because of a bug in the Ballerina test framework but arises from the behavior of the getFin function in the Prowide library (external Java library used) , which appends line endings (\r\n) to the end of each line in the resulting SWIFT FIN message. In Ballerina, when string templates are used, the line endings in the template are determined by the operating system: On Windows: The line endings are interpreted as \r\n. On Windows, the additional \r is preserved in the string. |
This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now. |
Description
I am encountering an issue where all my tests pass successfully when executed locally, but when I push the code to GitHub, the same tests consistently fail during the GitHub Actions workflow.
GitHub PR link:
ballerina-platform/module-ballerinax-financial.iso20022-to-swiftmt#5
Steps to Reproduce
Run the tests locally using the bal test command.
Push the code to GitHub.
Observe the test results during the GitHub Actions workflow execution.
Affected Version(s)
Ballerina 2210.10.1
OS, DB, other environment details and versions
Local OS - Windows 11
Related area
-> Test Framework
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: