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
Fix Kubernetes Maven Plugin integration (kubernetes-maven-plugin/it
) tests failing on windows
#2841
Comments
Hi @rohanKanojia, I can pick this up, Kindly assign this to me. Thanks. |
@l3002 : Hello, are you still working on this? If not, is it okay if I unassign you from this issue? |
@rohanKanojia : I'm still working on this, I'm having some trouble with the |
Please don't hesitate to ask for help whenever you get stuck. |
Sure. Thanks, I'll let you know in case I would need any help with the issue or I won't understand anything. It is just that for the last few weeks due to some ongoing events in my day job, I wasn't able to pay much attention to all of the issues assigned to me. Moreover, I also have a gig at hand that I need to work on. I just need some more time with the problem. I'm sure I'll be able to resolve it. Thanks again, I really appreciate all your help. |
@rohanKanojia : Just wanted to give you an update, I was able to solve issue with jkube/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/ExternalCommand.java Lines 115 to 123 in bb2e8f7
This is invoked to get version for Credential helper, here: Lines 90 to 91 in bb2e8f7
The issue is that the method mentioned in Not Only this but this same issue is actually leading to a build failure for project in windows as well. Here's a screenshot for your reference: I think we should address those through a new issue. Let me know your thoughts on the same. As of now, I'm not sure how to solve this problem as it would not be correct to use some other form of |
@l3002 : Could you please create a PR to fix
That's quite strange, I'm not able to reproduce this issue on my windows machine. Could you please provide more information about your environment? Maybe your environment settings are affecting test execution (ideally test shouldn't be affected by this) |
@rohanKanojia : Sure, I'll create a PR by tomorrow, Won't be able to complete it today, I've already logged off my laptop. I'll send the environment details tomorrow as well. |
@rohanKanojia : Hi Rohan, Sorry for bugging you but I'm having some issue with Here's a screenshot for your reference: But when I try to find differences between the two files, there is none related to the value of The below screenshot shows the same. I tried adding a line break at the end of the value in the Could you please try running the test after making the changes in local environment and let me know if the solution works on your local machine? |
@rohanKanojia : Do you want me to send you the changes that I made for solving the issue with line breaks? I made changes to I'm sorry but I haven't worked with integration tests before and therefore, I'm having these issue. I hope I'm not troubling you a lot. |
@l3002 : Let me try to look into this and see what's happening. I'm sorry I didn't investigate the issue properly and marked it as good first issue. Maybe it's a bit involved for contributors.
Not at all. You're helping us a lot by providing necessary patches and information related to complicated issues like these. There is nothing wrong in asking for help. |
@rohanKanojia : I actually learned a ton from this issue, as I said I had never worked with an integration test let alone tried to modified one and it has also helped me understand the codebase in a better as well, so it's not a problem at all. I'll still try to fix this on my own. As of now, I think that there could be an issue with parsing the text in file in the file to JSON format for validation or maybe while reading the files during And yeah I also wanted to ask you, how exactly does the
Thanks a lot, I really appreciate this. |
I tried checking why Lines 114 to 118 in 41b05b4
Although it's written in platform independent way but we're receiving the annotation value with Changing above code to this makes the test pass, but we need to check whether this is something that YAML doesn't support or Jackson is having some problem with adding if (value.contains("\n") && !value.endsWith("\n")) {
return value + "\n";
} |
@rohanKanojia : Sorry for the delay in response, I was quite busy for the past two day, I'll check your comments out tomorrow. Thanks again for helping out. |
@rohanKanojia : Okay, I understand it now.
Should I make these changes and raise a PR or investigate the issue first? |
@l3002 : Sorry for late reply. I think we need to investigate more in this issue. I checked it but couldn't figure out why it's behaving this way. I've removed the good first issue label as it seems a bit involved. |
Got it. |
…ialized on windows Related to eclipse-jkube#2841 Currently for enforcing trailing newline in case of multi line strings in resource annotations, we were relying on presence of `System.lineSeparator()`. This was causing problems as YAML multiline scalar values are converted into strings with Line Feed (`\n`) endings when they're deserialized into objects. Modify logic in MetadataVisitor with respect to this behavior. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
I've created #3014 to fix Regarding other two integration test failures Line 63 in 061c919
If we change this to
I think Jib build seems to have some problem with this change. We can stick to converting line separators to \n in ResourceVerify jkube/jkube-kit/common-it/src/main/java/org/eclipse/jkube/kit/common/ResourceVerify.java Line 91 in 061c919
To this: public static String readFile(File path) throws IOException {
return new String(FileCopyUtils.copyToByteArray(Files.newInputStream(path.toPath())), Charset.defaultCharset()).replaceAll(System.lineSeparator(), "\n");
} |
…ialized on windows Related to eclipse-jkube#2841 Currently for enforcing trailing newline in case of multi line strings in resource annotations, we were relying on presence of `System.lineSeparator()`. This was causing problems as YAML multiline scalar values are converted into strings with Line Feed (`\n`) endings when they're deserialized into objects. Modify logic in MetadataVisitor with respect to this behavior. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
…ialized on windows Related to eclipse-jkube#2841 Currently for enforcing trailing newline in case of multi line strings in resource annotations, we were relying on presence of `System.lineSeparator()`. This was causing problems as YAML multiline scalar values are converted into strings with Line Feed (`\n`) endings when they're deserialized into objects. Modify logic in MetadataVisitor with respect to this behavior. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
…alized on windows Related to #2841 Currently for enforcing trailing newline in case of multi line strings in resource annotations, we were relying on presence of `System.lineSeparator()`. This was causing problems as YAML multiline scalar values are converted into strings with Line Feed (`\n`) endings when they're deserialized into objects. Modify logic in MetadataVisitor with respect to this behavior. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
#3014 got merged . |
@rohanKanojia : Sure, I'll checkout the other ones tomorrow. |
Component
JKube Kit
Task description
Description
Related to #1338
When executing
mvn clean install
on Windows, the following unit tests are failing inkubernetes-maven-plugin/it
module:You can run a single test in
kubernetes-maven-plugin/it
module like this:I think it might have to do with line endings in test expectations
\n
vs line endings in generated Dockerfile / Kubernetes manifests. If this is the case, we would need to modify ResourceVerify class to ignore difference in line endings while comparing files.Expected Behavior
Kubernetes Maven Plugin integration tests should pass on windows
Acceptance Criteria
The text was updated successfully, but these errors were encountered: