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 2019/05/10 13:19:24 UTC

[flink] 01/04: [hotfix][tests] Extend Tar wrapper to support strip argument

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

commit 4bbc69626eb439c8fe0e6fbf066139d72e8d9795
Author: zentol <ch...@apache.org>
AuthorDate: Thu Jan 24 15:02:39 2019 +0100

    [hotfix][tests] Extend Tar wrapper to support strip argument
---
 .../java/org/apache/flink/tests/util/CommandLineWrapper.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/CommandLineWrapper.java b/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/CommandLineWrapper.java
index 50fd2f8..e9ee2e8 100644
--- a/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/CommandLineWrapper.java
+++ b/flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/CommandLineWrapper.java
@@ -113,6 +113,7 @@ public enum CommandLineWrapper {
 		private boolean zipped = false;
 		private boolean extract = false;
 		private Path targetDir;
+		private int strips = -1;
 
 		public TarBuilder(final Path file) {
 			this.file = file;
@@ -133,6 +134,11 @@ public enum CommandLineWrapper {
 			return this;
 		}
 
+		public TarBuilder strip(final int num) {
+			strips = num;
+			return this;
+		}
+
 		public String[] build() {
 			final List<String> commandsList = new ArrayList<>(4);
 			commandsList.add("tar");
@@ -146,6 +152,10 @@ public enum CommandLineWrapper {
 				commandsList.add("--directory");
 				commandsList.add(targetDir.toAbsolutePath().toString());
 			}
+			if (strips > 0) {
+				commandsList.add("--strip");
+				commandsList.add(String.valueOf(strips));
+			}
 			commandsList.add("-f");
 			commandsList.add(file.toAbsolutePath().toString());
 			return commandsList.toArray(new String[commandsList.size()]);