Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
FALCON-2081 ExtensionManagerIT fails occassionally
Fixed a rat-check error as part of this Jira as it was blocking testing and it was only 1 line change

Author: bvellanki <bvellanki@hortonworks.com>

Reviewers: "Venkat Ranganathan <venkat@hortonworks.com>, Sowmya Ramesh <sowmya_kr@apache.org>"

Closes #235 from bvellanki/FALCON-2081

(cherry picked from commit 40d9436)
Signed-off-by: bvellanki <bvellanki@hortonworks.com>
  • Loading branch information
bvellanki committed Jul 20, 2016
1 parent bbd8650 commit 3dc75dc856bc1c746b6cc0f1114d9a19594570aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
@@ -217,6 +217,7 @@
<exclude>**/db1.script</exclude>
<exclude>**/credential_provider.jceks</exclude>
<exclude>**/*.json</exclude>
<exclude>**/falcon-cli-hist.log</exclude>
</excludes>
</configuration>
<executions>
@@ -18,6 +18,7 @@

package org.apache.falcon.resource;

import org.apache.falcon.entity.v0.EntityType;
import org.apache.falcon.extensions.ExtensionProperties;
import org.apache.falcon.extensions.mirroring.hdfs.HdfsMirroringExtensionProperties;
import org.apache.falcon.extensions.store.AbstractTestExtensionStore;
@@ -110,12 +111,15 @@ public void testTrustedExtensionJob() throws Exception {
"extension -instances -jobName " + JOB_NAME_2 + " -fields status,clusters,tags"), 0);

// validate instance list results
context.waitForInstancesToStart(EntityType.PROCESS.name(), JOB_NAME_1, 10000);
ExtensionInstanceList instanceList = context.getExtensionInstances(JOB_NAME_1, START_TIME_1, endTime, "RUNNING",
null, null, null, null, null, null);
System.out.println("Validate running instances of extension job " + JOB_NAME_1 + ": \n"
+ instanceList.toString());
Assert.assertEquals(instanceList.numEntities, 1);
Assert.assertEquals(instanceList.entitySummary.get(0).instances.length, 1);

context.waitForInstancesToStart(EntityType.PROCESS.name(), JOB_NAME_2, 10000);
instanceList = context.getExtensionInstances(JOB_NAME_2, START_TIME_1, endTime, "RUNNING",
null, null, null, null, null, null);
System.out.println("Validate running instances of extension job " + JOB_NAME_2 + ": \n"
@@ -324,6 +324,21 @@ public ExtensionInstanceList getExtensionInstances(String jobName, String nomina
return response.getEntity(ExtensionInstanceList.class);
}

public void waitForInstancesToStart(String entityType, String entityName, long timeout) {
long mustEnd = System.currentTimeMillis() + timeout;
WebResource resource = this.service.path("api/instance/running/" + entityType + "/" + entityName);
InstancesResult instancesResult;
while (System.currentTimeMillis() < mustEnd) {
ClientResponse response = resource.header("Cookie", AUTH_COOKIE_EQ + authenticationToken)
.accept(MediaType.APPLICATION_JSON).type(MediaType.TEXT_XML)
.method(HttpMethod.GET, ClientResponse.class);
instancesResult = response.getEntity(InstancesResult.class);
if (instancesResult.getInstances() != null && instancesResult.getInstances().length > 0) {
break;
}
}
}

public ClientResponse submitAndSchedule(String template, Map<String, String> overlay, EntityType entityType)
throws Exception {
return submitAndSchedule(template, overlay, entityType, null, "", null);

0 comments on commit 3dc75dc

Please sign in to comment.