mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-22 13:39:39 -04:00
Check that network stress test data directory variable is not empty
This commit is contained in:
parent
f100ef6384
commit
d439058392
1 changed files with 4 additions and 3 deletions
|
@ -159,8 +159,8 @@ public class NetworkStressTest {
|
||||||
private Path createTestDataDirectory() throws IOException {
|
private Path createTestDataDirectory() throws IOException {
|
||||||
Path stressTestDirPath;
|
Path stressTestDirPath;
|
||||||
|
|
||||||
String stressTestDir = System.getenv(TEST_DIR_ENVVAR);
|
final String stressTestDir = System.getenv(TEST_DIR_ENVVAR);
|
||||||
if (stressTestDir != null) {
|
if ((stressTestDir != null) && !stressTestDir.equals("")) {
|
||||||
// Test directory specified, use and create if missing.
|
// Test directory specified, use and create if missing.
|
||||||
stressTestDirPath = Paths.get(stressTestDir);
|
stressTestDirPath = Paths.get(stressTestDir);
|
||||||
if (!Files.isDirectory(stressTestDirPath)) {
|
if (!Files.isDirectory(stressTestDirPath)) {
|
||||||
|
@ -181,7 +181,8 @@ public class NetworkStressTest {
|
||||||
*/
|
*/
|
||||||
private void deleteTestDataDirectory() throws IOException {
|
private void deleteTestDataDirectory() throws IOException {
|
||||||
// Based on <https://stackoverflow.com/a/27917071/6239236> by Tomasz Dzięcielewski.
|
// Based on <https://stackoverflow.com/a/27917071/6239236> by Tomasz Dzięcielewski.
|
||||||
boolean keep = System.getenv(TEST_DIR_ENVVAR) != null; // do not remove if given explicitly
|
final String stressTestDir = System.getenv(TEST_DIR_ENVVAR);
|
||||||
|
final boolean keep = (stressTestDir != null) && !stressTestDir.equals("");
|
||||||
Files.walkFileTree(testDataDir, new SimpleFileVisitor<Path>() {
|
Files.walkFileTree(testDataDir, new SimpleFileVisitor<Path>() {
|
||||||
@Override
|
@Override
|
||||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue