Skip to content

FileSecretIT is failing on windows  #3478

@rohanKanojia

Description

@rohanKanojia

Component

None

Task description

Description

Related to #3406

⚠️ A windows machine is required to reproduce and fix problems in this issue

FileSecretIT is failing on windows:

Error:    FileSecretIT.k8sResource_whenRun_generatesK8sSecret:35 � IllegalArgument Values not equal for entry: 'application.properties', expected 'a2V5MSA9IHZhbHVlMQprZXkyID0gdmFsdWUyCmtleTMgPSB2YWx1ZTM=' but was 'a2V5MSA9IHZhbHVlMQ0Ka2V5MiA9IHZhbHVlMg0Ka2V5MyA9IHZhbHVlMw=='
Error:    FileSecretIT.ocResource_whenRun_generatesK8sSecret:48 � IllegalArgument Values not equal for entry: 'application.properties', expected 'a2V5MSA9IHZhbHVlMQprZXkyID0gdmFsdWUyCmtleTMgPSB2YWx1ZTM=' but was 'a2V5MSA9IHZhbHVlMQ0Ka2V5MiA9IHZhbHVlMg0Ka2V5MyA9IHZhbHVlMw=='

This issue looks related to one issue I had fixed #3014

Problem seems to be here :

private byte[] readContent(String location) throws IOException {
return Files.readAllBytes(Paths.get(location));
}

Jackson generates annotation with platform specific line delimiters /r/n for windows.

If we change it like this, it makes test pass:

-        return Files.readAllBytes(Paths.get(location));
+        String data = new String(Files.readAllBytes(Paths.get(location)));
+        data = data.replaceAll("\r?\n", "\n");
+        return data.getBytes();

Expected Behavior

FileSecretIT should pass on windows

Acceptance Criteria

  • FileSecretIT should pass on windows and Linux

Metadata

Metadata

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions