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

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


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

commit 42dd176e170d2a4343d6e40cc4f15d0fb379d43c
Author: Alexander Fedulov <[email protected]>
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 48a1c5f..20b72ff 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 6637440..1dba568 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
@@ -139,14 +139,13 @@ public class PrometheusReporterEndToEndITCase extends 
TestLogger {
        @Test
        public void testReporter() throws Exception {
                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
                );
 

Reply via email to