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

fix: windows test failure in ConfigDefTest #4273

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
import static org.junit.Assert.assertTrue;

import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.Set;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -280,11 +281,15 @@ public void testBuildConfigDef() {

@Test
public void testSaveConfigDef() throws IOException {
byte[] confData;
try (InputStream is = this.getClass().getClassLoader().getResourceAsStream("test_conf_2.conf")) {
confData = new byte[is.available()];
ByteStreams.readFully(is, confData);
StringBuilder sb = new StringBuilder();
try (InputStream is = this.getClass().getClassLoader().getResourceAsStream("test_conf_2.conf");
BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
sb.append(line).append(System.lineSeparator());
}
}
String confData = sb.toString();

ConfigDef configDef = ConfigDef.of(TestConfig2.class);
String readConf;
Expand All @@ -294,7 +299,7 @@ public void testSaveConfigDef() throws IOException {
log.info("\n{}", readConf);
}

assertEquals(new String(confData, UTF_8), readConf);
assertEquals(confData, readConf);
}

}
Loading