zentol commented on a change in pull request #10106: [FLINK-11463][e2e] Design
the e2e java framework so that at least the Kafka streaming tests can run on it
URL: https://github.com/apache/flink/pull/10106#discussion_r344218088
##########
File path:
flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/FlinkDistribution.java
##########
@@ -123,20 +126,28 @@ public void afterTestSuccess() {
@Override
public void afterTestFailure() {
- logBackupDir.ifPresent(backupLocation -> {
+ if (logBackupDir != null) {
final UUID id = UUID.randomUUID();
- LOG.info("Backing up logs to {}/{}.", backupLocation,
id);
+ LOG.info("Backing up logs to {}/{}.", logBackupDir, id);
try {
- Files.createDirectories(backupLocation);
- FileUtils.copyDirectory(log.toFile(),
backupLocation.resolve(id.toString()).toFile());
+ Files.createDirectories(logBackupDir);
+ FileUtils.copyDirectory(log.toFile(),
logBackupDir.resolve(id.toString()).toFile());
} catch (IOException e) {
LOG.warn("An error occurred while backing up
logs.", e);
}
- });
-
+ }
afterTestSuccess();
}
+ /**
+ * Read the value of `rest.port` part in
FLINK_DIST_DIR/conf/flink-conf.yaml.
+ *
+ * @return the rest port which standalone Flink cluster will listen.
+ */
+ public int getRestPort() {
+ return defaultConfig.getInteger("rest.port", 8081);
Review comment:
We can't rely on port sweeps, since the goal is to be able to run these
tests in parallel; in that case multiple flink clusters (and thus REST APIs)
are running.
The flink cluster should not be modifying the flink.conf.yaml because this
is a user-controlled file. Similarly, creating _some_ file containing the port
pollutes the distribution, which should be avoided in production settings,
which we are testing.
This would only be acceptable if the file were only created for the test,
but that implies test-specific logic in production code that we again don't
want.
I think that running a regex against the logs is likely the easiest and most
reliable solution, even if it is prone to breakage if the log message changes.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services