You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by di...@apache.org on 2020/09/17 11:06:35 UTC
[flink] branch release-1.11 updated: [FLINK-9992][tests] Fix
FsStorageLocationReferenceTest#testEncodeAndDecode by adding retries to
generate a valid path
This is an automated email from the ASF dual-hosted git repository.
dianfu pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.11 by this push:
new 95330f7 [FLINK-9992][tests] Fix FsStorageLocationReferenceTest#testEncodeAndDecode by adding retries to generate a valid path
95330f7 is described below
commit 95330f748a753fdeb0aff9331be52d1ff40a5b81
Author: Dian Fu <di...@apache.org>
AuthorDate: Fri Jul 31 13:11:53 2020 +0800
[FLINK-9992][tests] Fix FsStorageLocationReferenceTest#testEncodeAndDecode by adding retries to generate a valid path
This closes #13034
---
.../filesystem/FsStorageLocationReferenceTest.java | 33 +++++++++++++---------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsStorageLocationReferenceTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsStorageLocationReferenceTest.java
index b0bad64..6afb461 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsStorageLocationReferenceTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsStorageLocationReferenceTest.java
@@ -72,19 +72,26 @@ public class FsStorageLocationReferenceTest extends TestLogger {
// ------------------------------------------------------------------------
private static Path randomPath(Random rnd) {
- final StringBuilder path = new StringBuilder();
-
- // scheme
- path.append(StringUtils.getRandomString(rnd, 1, 5, 'a', 'z'));
- path.append("://");
- path.append(StringUtils.getRandomString(rnd, 10, 20)); // authority
- path.append(rnd.nextInt(50000) + 1); // port
-
- for (int i = rnd.nextInt(5) + 1; i > 0; i--) {
- path.append('/');
- path.append(StringUtils.getRandomString(rnd, 3, 15));
+ while (true) {
+ try {
+ final StringBuilder path = new StringBuilder();
+
+ // scheme
+ path.append(StringUtils.getRandomString(rnd, 1, 5, 'a', 'z'));
+ path.append("://");
+ path.append(StringUtils.getRandomString(rnd, 10, 20)); // authority
+ path.append(":");
+ path.append(rnd.nextInt(50000) + 1); // port
+
+ for (int j = rnd.nextInt(5) + 1; j > 0; j--) {
+ path.append('/');
+ path.append(StringUtils.getRandomString(rnd, 3, 15));
+ }
+
+ return new Path(path.toString());
+ } catch (Throwable t) {
+ // ignore the exception and retry
+ }
}
-
- return new Path(path.toString());
}
}