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

SerializationTest is failing on windows #3113

Closed
Sintivrousai opened this issue May 29, 2024 · 2 comments · Fixed by #3115
Closed

SerializationTest is failing on windows #3113

Sintivrousai opened this issue May 29, 2024 · 2 comments · Fixed by #3115
Assignees
Milestone

Comments

@Sintivrousai
Copy link
Contributor

Sintivrousai commented May 29, 2024

Part of #1338

SerializationTest is failing after the latest commits.

[ERROR] Failures:
[ERROR] SerializationTest$MultiLineStringsSerializedToScalarYamlBlocks.whenStringEndingWithNewline_thenAddBlockIndicatorInSerializedObject:240

I would like to be assigned for the issue since I have already done some research.

@rohanKanojia
Copy link
Member

@Sintivrousai : Thanks for taking care of this issue. It looks like I missed updating this test while addressing PR review comments on #3014 .

I think this test is trying to test invalid scenario. It's trying to serialize a multiline YAML scalar value with platform specific line endings (\r\n for Windows and \n for Linux). However, based on my observations while investigating #3014 a constructured object must contain \n to be correctly serialized into multiline scalar value.

I think we should update the test to not use %n and String.format, just directly use \n, we would slightly need to adjust the test name as well so that it's more clear:

-    void whenStringEndingWithNewline_thenAddBlockIndicatorInSerializedObject(@TempDir Path targetDir) throws IOException {
+    void unmarshal_whenStringEndingWithNewline_thenAddBlockIndicatorInSerializedObject(@TempDir Path targetDir) throws IOException {
       // Given
       final File targetFile = targetDir.resolve("cm.yaml").toFile();
       final ConfigMap source = new ConfigMapBuilder()
               .withNewMetadata()
-              .addToAnnotations("proxy.istio.io/config", String.format("proxyMetadata:%n    ISTIO_META_DNS_CAPTURE: \"false\"%nholdApplicationUntilProxyStarts: true\n"))
+              .addToAnnotations("proxy.istio.io/config", "proxyMetadata:\n    ISTIO_META_DNS_CAPTURE: \"false\"\nholdApplicationUntilProxyStarts: true\n")

Could you please check if test passes on your machine after making these changes?

Sintivrousai added a commit to Sintivrousai/jkube that referenced this issue May 30, 2024
@Sintivrousai
Copy link
Contributor Author

Your adjustment worked. I have made a pull request.

@rohanKanojia rohanKanojia changed the title SerializationTest is failing SerializationTest is failing on windows May 31, 2024
@manusa manusa added this to the 1.17.0 milestone Jun 4, 2024 — with automated-tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants