From fac3791d9d43f0c6feec78e414687d0b6e949f86 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Fri, 18 Aug 2023 12:59:11 -0400 Subject: [PATCH] Japi 524 ws fileio ws fs regressions (#632) * JAPI-524 Address wsfileio/wsfs junit failures - Ignores invalid fileio tests until HPCC_30117 is addressed - WsFS conditionally provides DZ path and name if available - Adds CUSTOM_MVN_OPTIONS env var as mvn command arg Signed-off-by: Rodrigo Pastrana * JAPI-524 env var test Signed-off-by: Rodrigo Pastrana --------- Signed-off-by: Rodrigo Pastrana --- .github/workflows/httpsUnitTests.yml | 2 +- .../ws/client/HPCCFileSprayClient.java | 13 ++++++++++++- .../ws/client/WSFileIOClientTest.java | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/httpsUnitTests.yml b/.github/workflows/httpsUnitTests.yml index 4dd93074b..7382205db 100644 --- a/.github/workflows/httpsUnitTests.yml +++ b/.github/workflows/httpsUnitTests.yml @@ -123,4 +123,4 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build with Maven - run: mvn -B --activate-profiles jenkins-on-demand -Dmaven.gpg.skip=true -Dmaven.javadoc.skip=true -Dmaven.test.failure.ignore=false -Dhpccconn=https://eclwatch.default:8010 -Dwssqlconn=https://sql2ecl.default:8510 install \ No newline at end of file + run: mvn -B --activate-profiles jenkins-on-demand -Dmaven.gpg.skip=true -Dmaven.javadoc.skip=true -Dmaven.test.failure.ignore=false -Dhpccconn=https://eclwatch.default:8010 -Dwssqlconn=https://sql2ecl.default:8510 -DHPCC30117=open install diff --git a/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCFileSprayClient.java b/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCFileSprayClient.java index 212bb281c..87d0c5d61 100644 --- a/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCFileSprayClient.java +++ b/wsclient/src/main/java/org/hpccsystems/ws/client/HPCCFileSprayClient.java @@ -1481,7 +1481,18 @@ public boolean uploadLargeFile(File uploadFile, DropZoneWrapper dropZone) URLConnection fileUploadConnection = null; URL fileUploadURL = null; String uploadurlbuilder = UPLOADURI; - uploadurlbuilder += "&NetAddress=" + dropZone.getNetAddress(); + + if (dropZone.getPath().isEmpty()) + { + log.error("HPCCFileSprayClient::uploadLargeFile: empty dropZone path detected!"); + return false; + } + + uploadurlbuilder += "&NetAddress=" + dropZone.getNetAddress() + "&Path=" + dropZone.getPath(); + + if (!dropZone.getName().isEmpty()) + uploadurlbuilder += "&DropZoneName=" + dropZone.getName(); + String path = dropZone.getPath().trim(); if (!path.endsWith("/")) path += "/"; diff --git a/wsclient/src/test/java/org/hpccsystems/ws/client/WSFileIOClientTest.java b/wsclient/src/test/java/org/hpccsystems/ws/client/WSFileIOClientTest.java index ac8c9e7b9..4b81cea1c 100644 --- a/wsclient/src/test/java/org/hpccsystems/ws/client/WSFileIOClientTest.java +++ b/wsclient/src/test/java/org/hpccsystems/ws/client/WSFileIOClientTest.java @@ -19,6 +19,7 @@ HPCC SYSTEMS software Copyright (C) 2019 HPCC Systems®. import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; import java.util.HashSet; import java.util.Set; @@ -44,6 +45,8 @@ public class WSFileIOClientTest extends BaseRemoteTest private final static String testfilename = System.getProperty("lztestfile", "myfilename.txt"); private final static String targetLZ = System.getProperty("lzname", "localhost"); + private final static String targetLZPath = System.getProperty("lzpath", "/var/lib/HPCCSystems/mydropzone"); + private final static String HPCC_30117 = System.getProperty("HPCC30117", "fixed"); static { @@ -52,13 +55,21 @@ public class WSFileIOClientTest extends BaseRemoteTest if (System.getProperty("lzname") == null) System.out.println("lzname not provided - defaulting to localhost"); + + if (System.getProperty("lzpath") == null) + System.out.println("lzpath not provided - defaulting to /var/lib/HPCCSystems/mydropzone"); + + if (System.getProperty("HPCC30117") == null) + System.out.println("HPCC30117 status not provided - defaulting to fixed"); + else + System.out.println("HPCC30117 status: '" + HPCC_30117 + "'"); } @Test public void copyFile() throws Exception { Assume.assumeFalse("Test not valid on containerized HPCC environment", client.isTargetHPCCContainerized()); - + assumeTrue("Ignoring test 'copyFile' because HPCC-30117 is not fixed", HPCC_30117.equalsIgnoreCase("fixed")); String lzfile=System.currentTimeMillis() + "_csvtest.csv"; String hpccfilename="temp::" + lzfile; client.createHPCCFile(lzfile, targetLZ, true); @@ -135,7 +146,7 @@ public void copyFile() throws Exception public void AcreateHPCCFile() throws Exception, ArrayOfEspExceptionWrapper { Assume.assumeFalse("Test not valid on containerized HPCC environment", client.isTargetHPCCContainerized()); - + assumeTrue("Ignoring test 'copyFile' because HPCC-30117 is not fixed", HPCC_30117.equalsIgnoreCase("fixed")); System.out.println("Creating file: '" + testfilename + "' on LandingZone: '" + targetLZ + "' on HPCC: '" + super.connString +"'"); Assert.assertTrue(client.createHPCCFile(testfilename, targetLZ, true)); } @@ -143,6 +154,7 @@ public void AcreateHPCCFile() throws Exception, ArrayOfEspExceptionWrapper @Test public void BwriteHPCCFile() throws Exception, ArrayOfEspExceptionWrapper { + assumeTrue("Ignoring test 'copyFile' because HPCC-30117 is not fixed", HPCC_30117.equalsIgnoreCase("fixed")); System.out.println("Writing data to file: '" + testfilename + "' on LandingZone: '" + targetLZ + "' on HPCC: '" + super.connString +"'"); byte[] data = "HELLO MY DARLING, HELLO MY DEAR!1234567890ABCDEFGHIJKLMNOPQRSTUVXYZ".getBytes(); Assert.assertTrue(client.writeHPCCFileData(data, testfilename, targetLZ, true, 0, 20)); @@ -152,6 +164,7 @@ public void BwriteHPCCFile() throws Exception, ArrayOfEspExceptionWrapper public void CreadHPCCFile() throws Exception, ArrayOfEspExceptionWrapper { Assume.assumeFalse("Test not valid on containerized HPCC environment", client.isTargetHPCCContainerized()); + assumeTrue("Ignoring test 'copyFile' because HPCC-30117 is not fixed", HPCC_30117.equalsIgnoreCase("fixed")); System.out.println("reading data from file: '" + testfilename + "' on LandingZone: '" + targetLZ + "' on HPCC: '" + super.connString +"'"); byte[] data = "HELLO MY DARLING, HELLO MY DEAR!1234567890ABCDEFGHIJKLMNOPQRSTUVXYZ".getBytes();