Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC4J-561 copyfile test wait for spray completion #667

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/httpsUnitTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,28 @@ jobs:

- name: Install HPCC Cluster
run: |
echo -e "certificates:\n enabled: true\ndafilesrv:\n - name: rowservice\n disabled: false\n application: stream\n service:\n servicePort: 7600\n visibility: global" > values.yaml
cat <<EOF > values.yaml
certificates:
enabled: true
dafilesrv:
- name: rowservice
disabled: false
application: stream
service:
servicePort: 7600
visibility: global
- name: direct-access
disabled: true
application: directio
service:
servicePort: 7200
visibility: local
- name: spray-service
application: spray
service:
servicePort: 7300
visibility: cluster
EOF
helm repo add hpcc https://hpcc-systems.github.io/helm-chart
helm repo update
helm install myhpcc hpcc/hpcc -f values.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ HPCC SYSTEMS software Copyright (C) 2019 HPCC Systems®.
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.apache.axis2.AxisFault;
Expand Down Expand Up @@ -67,45 +69,50 @@ public class WSFileIOClientTest extends BaseRemoteTest
@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);
byte[] data = "Product,SKU,Color\r\nBike,1234,Blue\r\nCar,2345,Red\r\n".getBytes();
client.writeHPCCFileData(data, lzfile, targetLZ, true, 0, 20);
try
{
ProgressResponseWrapper dfuspray=wsclient.getFileSprayClient().sprayVariable(
System.out.println("Starting file spray.");
ProgressResponseWrapper dfuspray = wsclient.getFileSprayClient().sprayVariable(
new DelimitedDataOptions(),
wsclient.getFileSprayClient().fetchLocalDropZones().get(0),
lzfile,"~" + hpccfilename,"",thorClusterFileGroup,true,
HPCCFileSprayClient.SprayVariableFormat.DFUff_csv,
null, null, null, null, null, null, null);
Thread.sleep(1000);
int wait=60;
if (dfuspray.getExceptions() != null
&& dfuspray.getExceptions().getException() != null
&& dfuspray.getExceptions().getException().size()>0)
&& dfuspray.getExceptions().getException() != null
&& dfuspray.getExceptions().getException().size()>0)
{
fail(dfuspray.getExceptions().getException().get(0).getMessage());
}
if (dfuspray.getSecsLeft()>0)

List<String> whiteListedStates = Arrays.asList( "queued", "started", "unknown", "finished", "monitoring");
int waitCount = 0;
int MAX_WAIT_COUNT = 60;

ProgressResponseWrapper dfuProgress = null;
do
{
System.out.println("Still spraying, waiting 1 sec...");
for (int i=wait;i>0;i--)
dfuProgress = wsclient.getFileSprayClient().getDfuProgress(dfuspray.getWuid());
boolean stateIsWhiteListed = whiteListedStates.contains(dfuProgress.getState());
if (!stateIsWhiteListed)
{
if (dfuspray.getSecsLeft()==0)
{
i=0;
}
else
{
Thread.sleep(1000);
}
fail("File spray failed: Summary: " + dfuProgress.getSummaryMessage() + " Exceptions: " + dfuProgress.getExceptions());
}
}

if (dfuProgress.getPercentDone() < 100)
{
Thread.sleep(1000);
System.out.println("File spray percent complete: " + dfuProgress.getPercentDone() + "% Sleeping for 1sec to wait for spray.");
waitCount++;
}
} while (waitCount < 60 && dfuProgress.getPercentDone() < 100);

assumeTrue("File spray did not complete within: " + MAX_WAIT_COUNT + "s. Failing test.", waitCount < MAX_WAIT_COUNT);

System.out.println("Test file successfully sprayed to " + "~" + hpccfilename + ", attempting copy to " + hpccfilename + "_2");
wsclient.getFileSprayClient().copyFile(hpccfilename,hpccfilename + "_2",true);
Expand Down
Loading