You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2020/03/27 11:15:30 UTC

[flink] branch release-1.10 updated: [FLINK-16825][prometheus][tests] Use Path returned by DownloadCache

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.10 by this push:
     new 451b7ac  [FLINK-16825][prometheus][tests] Use Path returned by DownloadCache
451b7ac is described below

commit 451b7acabb4f345ee46d0b5cf9d0feef2b1ca1b1
Author: Alexander Fedulov <14...@users.noreply.github.com>
AuthorDate: Thu Mar 19 23:41:09 2020 +0100

    [FLINK-16825][prometheus][tests] Use Path returned by DownloadCache
    
    If the test is ran multiple times, newly downloaded files will get numbered prefixes (e.g. file.tar.gz.1). This causes an error because the wrong bath is used. This commit fixes this issue.
---
 .../org/apache/flink/tests/util/cache/AbstractDownloadCache.java     | 2 +-
 .../metrics/prometheus/tests/PrometheusReporterEndToEndITCase.java   | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/cache/AbstractDownloadCache.java b/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/cache/AbstractDownloadCache.java
index 4250f1d..e052717 100644
--- a/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/cache/AbstractDownloadCache.java
+++ b/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/cache/AbstractDownloadCache.java
@@ -113,8 +113,8 @@ abstract class AbstractDownloadCache implements DownloadCache {
 
 		final Path cacheFile;
 		if (cachedFile.isPresent()) {
-			log.info("Using cached version of {}.", url);
 			cacheFile = cachedFile.get();
+			log.info("Using cached version of {} from {}", url, cacheFile.toAbsolutePath());
 		} else {
 			final Path scopedDownloadDir = downloadsDir.resolve(String.valueOf(url.hashCode()));
 			Files.createDirectories(scopedDownloadDir);
diff --git a/flink-end-to-end-tests/flink-metrics-reporter-prometheus-test/src/test/java/org/apache/flink/metrics/prometheus/tests/PrometheusReporterEndToEndITCase.java b/flink-end-to-end-tests/flink-metrics-reporter-prometheus-test/src/test/java/org/apache/flink/metrics/prometheus/tests/PrometheusReporterEndToEndITCase.java
index 56643b2..89023f8 100644
--- a/flink-end-to-end-tests/flink-metrics-reporter-prometheus-test/src/test/java/org/apache/flink/metrics/prometheus/tests/PrometheusReporterEndToEndITCase.java
+++ b/flink-end-to-end-tests/flink-metrics-reporter-prometheus-test/src/test/java/org/apache/flink/metrics/prometheus/tests/PrometheusReporterEndToEndITCase.java
@@ -108,14 +108,13 @@ public class PrometheusReporterEndToEndITCase extends TestLogger {
 		dist.appendConfiguration(config);
 
 		final Path tmpPrometheusDir = tmp.newFolder().toPath().resolve("prometheus");
-		final Path prometheusArchive = tmpPrometheusDir.resolve(PROMETHEUS_FILE_NAME + ".tar.gz");
 		final Path prometheusBinDir = tmpPrometheusDir.resolve(PROMETHEUS_FILE_NAME);
 		final Path prometheusConfig = prometheusBinDir.resolve("prometheus.yml");
 		final Path prometheusBinary = prometheusBinDir.resolve("prometheus");
 		Files.createDirectory(tmpPrometheusDir);
 
-		downloadCache.getOrDownload(
-			"https://github.com/prometheus/prometheus/releases/download/v" + PROMETHEUS_VERSION + '/' + prometheusArchive.getFileName(),
+		final Path prometheusArchive = downloadCache.getOrDownload(
+			"https://github.com/prometheus/prometheus/releases/download/v" + PROMETHEUS_VERSION + '/' + PROMETHEUS_FILE_NAME + ".tar.gz",
 			tmpPrometheusDir
 		);