Skip to content

Commit

Permalink
[minor] Add project.basedir system property, use in CliFrontendTestUtils
Browse files Browse the repository at this point in the history
Before, we were relying on the current working directory, which is
unreliable and can change, depending on where/how tests are executed.
  • Loading branch information
aljoscha committed Oct 27, 2020
1 parent fca78b8 commit 7aa510c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.nio.file.Path;
import java.nio.file.Paths;

import static org.junit.Assert.assertEquals;

Expand All @@ -44,7 +46,9 @@ public class CliFrontendTestUtils {
private static final PrintStream previousSysout = System.out;

public static String getTestJarPath() throws FileNotFoundException, MalformedURLException {
File f = new File("target/maven-test-jar.jar");
String projectBaseDir = System.getProperty("project.basedir");
Path testJarPath = Paths.get(projectBaseDir, "target", "maven-test-jar.jar");
File f = testJarPath.toFile();
if (!f.exists()) {
throw new FileNotFoundException("Test jar not present. Invoke tests using maven "
+ "or build the jar using 'mvn process-test-classes' in flink-clients");
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1548,6 +1548,7 @@ under the License.
<log4j.configuration>${log4j.configuration}</log4j.configuration>
<hadoop.version>${hadoop.version}</hadoop.version>
<execution.checkpointing.unaligned>true</execution.checkpointing.unaligned>
<project.basedir>${project.basedir}</project.basedir>
</systemPropertyVariables>
<argLine>-Xms256m -Xmx2048m -Dmvn.forkNumber=${surefire.forkNumber} -XX:+UseG1GC</argLine>
</configuration>
Expand Down

0 comments on commit 7aa510c

Please sign in to comment.