Skip to content

Commit

Permalink
Fix windows newline issue in test (elastic#51030)
Browse files Browse the repository at this point in the history
Fixes HttpCertificateCommandTests.testTextFileSubstitutions on Windows

Resolves: elastic#50964
  • Loading branch information
tvernum authored and SivagurunathanV committed Jan 21, 2020
1 parent 9dde43c commit 70d3973
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import joptsimple.OptionSet;
import org.apache.lucene.util.Constants;
import org.bouncycastle.asn1.DERIA5String;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
Expand Down Expand Up @@ -530,13 +529,12 @@ public void testGuessFileType() throws Exception {
}

public void testTextFileSubstitutions() throws Exception {
assumeFalse("https://github.com/elastic/elasticsearch/issues/50964", Constants.WINDOWS);
CheckedBiFunction<String, Map<String, String>, String, Exception> copy = (source, subs) -> {
try (InputStream in = new ByteArrayInputStream(source.getBytes(StandardCharsets.UTF_8));
StringWriter out = new StringWriter();
PrintWriter writer = new PrintWriter(out)) {
HttpCertificateCommand.copyWithSubstitutions(in, writer, subs);
return out.toString();
return out.toString().replace("\r\n", "\n");
}
};
assertThat(copy.apply("abc\n", Map.of()), is("abc\n"));
Expand Down

0 comments on commit 70d3973

Please sign in to comment.