zentol commented on a change in pull request #18509:
URL: https://github.com/apache/flink/pull/18509#discussion_r794355640
##########
File path:
flink-connectors/flink-connector-cassandra/src/test/java/org/apache/flink/streaming/connectors/cassandra/CassandraConnectorITCase.java
##########
@@ -237,6 +249,46 @@ public static void startAndInitializeCassandra() {
CREATE_TABLE_QUERY.replace(TABLE_NAME_VARIABLE,
TABLE_NAME_PREFIX + "initial"));
}
+ private static void raiseCassandraRequestsTimeouts() {
+ try {
+ final Path configurationPath = TEMPORARY_FOLDER.newFile().toPath();
+ CASSANDRA_CONTAINER.copyFileFromContainer(
+ "/etc/cassandra/cassandra.yaml",
configurationPath.toAbsolutePath().toString());
+ String configuration =
+ new String(Files.readAllBytes(configurationPath),
StandardCharsets.UTF_8);
+ String patchedConfiguration =
+ configuration
+ .replaceAll(
+ "request_timeout_in_ms: [0-9]+",
"request_timeout_in_ms: 30000")
+ .replaceAll(
+ "read_request_timeout_in_ms: [0-9]+",
+ "read_request_timeout_in_ms: 15000")
+ .replaceAll(
+ "write_request_timeout_in_ms: [0-9]+",
+ "write_request_timeout_in_ms: 6000");
+ CASSANDRA_CONTAINER.copyFileToContainer(
+
Transferable.of(patchedConfiguration.getBytes(StandardCharsets.UTF_8)),
+ "/etc/cassandra/cassandra.yaml");
+ } catch (IOException e) {
+ throw new RuntimeException("Unable to open Cassandra configuration
file ", e);
+ }
+ }
+
+ @Test
+ public void testRaiseCassandraRequestsTimeouts() throws IOException {
+ // raiseCassandraRequestsTimeouts() was already called in @BeforeClass,
+ // do not change the container conf twice, just assert that it was
indeed changed in the
+ // container
+ final Path configurationPath = TEMPORARY_FOLDER.newFile().toPath();
+ CASSANDRA_CONTAINER.copyFileFromContainer(
+ "/etc/cassandra/cassandra.yaml",
configurationPath.toAbsolutePath().toString());
+ final String configuration =
+ new String(Files.readAllBytes(configurationPath),
StandardCharsets.UTF_8);
+ assertTrue(configuration.contains("request_timeout_in_ms: 30000"));
+ assertTrue(configuration.contains("read_request_timeout_in_ms:
15000"));
+ assertTrue(configuration.contains("write_request_timeout_in_ms:
6000"));
Review comment:
We are trying to migrate to junit5 + assertj. If it is possible to use
assertj without having to change other tests in the class then it's usually
what you should do, but in this case the class already imports hamcrest
assertThat, so I'd leave the PR as is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]