Repository: falcon
Updated Branches:
  refs/heads/master 2ebf12837 -> c6c92134e


FALCON-1253 Fortify ExternalFSTest. Contributed by Ruslan Ostafiychuk


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/c6c92134
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/c6c92134
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/c6c92134

Branch: refs/heads/master
Commit: c6c92134efb727918da69c9cd31206dff29cddad
Parents: 2ebf128
Author: Ruslan Ostafiychuk <[email protected]>
Authored: Wed Jun 3 14:43:12 2015 +0300
Committer: Ruslan Ostafiychuk <[email protected]>
Committed: Wed Jun 3 15:44:00 2015 +0300

----------------------------------------------------------------------
 falcon-regression/CHANGES.txt                   |  2 +
 .../regression/core/util/InstanceUtil.java      | 42 +++++++++++---------
 2 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/c6c92134/falcon-regression/CHANGES.txt
----------------------------------------------------------------------
diff --git a/falcon-regression/CHANGES.txt b/falcon-regression/CHANGES.txt
index ecff1c6..e55800a 100644
--- a/falcon-regression/CHANGES.txt
+++ b/falcon-regression/CHANGES.txt
@@ -87,6 +87,8 @@ Trunk (Unreleased)
    via Samarth Gupta)
 
   IMPROVEMENTS
+   FALCON-1253 Fortify ExternalFSTest (Ruslan Ostafiychuk)
+
    FALCON-1243 Feed test update as per new UI changes (Namit Maheshwari)
 
    FALCON-1241 Fix SearchApiTest according to changes in API, tag 
ClusterSetupTest,

http://git-wip-us.apache.org/repos/asf/falcon/blob/c6c92134/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/InstanceUtil.java
----------------------------------------------------------------------
diff --git 
a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/InstanceUtil.java
 
b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/InstanceUtil.java
index 1ce1a13..9aa3a0b 100644
--- 
a/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/InstanceUtil.java
+++ 
b/falcon-regression/merlin-core/src/main/java/org/apache/falcon/regression/core/util/InstanceUtil.java
@@ -538,28 +538,34 @@ public final class InstanceUtil {
             Assert.fail("Could not retrieve bundles");
         }
         List<String> bundleIds = OozieUtil.getBundleIds(bundleJobs);
-        String bundleId = OozieUtil.getMaxId(bundleIds);
-        LOGGER.info(String.format("Using bundle %s", bundleId));
-        final String coordId;
-        final Status bundleStatus = 
client.getBundleJobInfo(bundleId).getStatus();
-        Assert.assertTrue(RUNNING_PREP_SUCCEEDED.contains(bundleStatus),
-                String.format("Bundle job %s is should be prep/running but is 
%s", bundleId, bundleStatus));
-        OozieUtil.waitForCoordinatorJobCreation(client, bundleId);
-        List<CoordinatorJob> coords = 
client.getBundleJobInfo(bundleId).getCoordinators();
-        List<String> cIds = new ArrayList<>();
-        if (entityType == EntityType.PROCESS) {
-            for (CoordinatorJob coord : coords) {
-                cIds.add(coord.getId());
-            }
-            coordId = OozieUtil.getMinId(cIds);
-        } else {
-            for (CoordinatorJob coord : coords) {
-                if (coord.getAppName().contains("FEED_REPLICATION")) {
+        Collections.sort(bundleIds, Collections.reverseOrder());
+        String coordId = null;
+        for (String bundleId : bundleIds) {
+            LOGGER.info(String.format("Using bundle %s", bundleId));
+            final Status status = 
client.getBundleJobInfo(bundleId).getStatus();
+            Assert.assertTrue(RUNNING_PREP_SUCCEEDED.contains(status),
+                String.format("Bundle job %s is should be prep/running but is 
%s", bundleId, status));
+            OozieUtil.waitForCoordinatorJobCreation(client, bundleId);
+            List<CoordinatorJob> coords = 
client.getBundleJobInfo(bundleId).getCoordinators();
+            List<String> cIds = new ArrayList<>();
+            if (entityType == EntityType.PROCESS) {
+                for (CoordinatorJob coord : coords) {
                     cIds.add(coord.getId());
                 }
+                coordId = OozieUtil.getMinId(cIds);
+            } else {
+                for (CoordinatorJob coord : coords) {
+                    if (coord.getAppName().contains("FEED_REPLICATION")) {
+                        cIds.add(coord.getId());
+                    }
+                }
+                if (!cIds.isEmpty()) {
+                    coordId = cIds.get(0);
+                    break;
+                }
             }
-            coordId = cIds.get(0);
         }
+        Assert.assertNotNull(coordId, "Coordinator id not found");
         LOGGER.info(String.format("Using coordinator id: %s", coordId));
         int maxTries = 50;
         int totalSleepTime = totalMinutesToWait * 60;

Reply via email to