diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestDeleteWithSlowFollower.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestDeleteWithSlowFollower.java index cb42ceb969c2..a373de10dedb 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestDeleteWithSlowFollower.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestDeleteWithSlowFollower.java @@ -72,6 +72,7 @@ import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL; import org.junit.AfterClass; import org.junit.Assert; +import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; @@ -212,7 +213,8 @@ public void testDeleteKeyWithSlowFollower() throws Exception { KeyOutputStream groupOutputStream = (KeyOutputStream) key.getOutputStream(); List locationInfoList = groupOutputStream.getLocationInfoList(); - Assert.assertEquals(1, locationInfoList.size()); + Assume.assumeTrue("Expected exactly a single location, but got: " + + locationInfoList.size(), 1 == locationInfoList.size()); OmKeyLocationInfo omKeyLocationInfo = locationInfoList.get(0); long containerID = omKeyLocationInfo.getContainerID(); // A container is created on the datanode. Now figure out a follower node to @@ -224,7 +226,7 @@ public void testDeleteKeyWithSlowFollower() throws Exception { cluster.getStorageContainerManager().getPipelineManager() .getPipelines(new RatisReplicationConfig( HddsProtos.ReplicationFactor.THREE)); - Assert.assertTrue(pipelineList.size() >= FACTOR_THREE_PIPELINE_COUNT); + Assume.assumeTrue(pipelineList.size() >= FACTOR_THREE_PIPELINE_COUNT); Pipeline pipeline = pipelineList.get(0); for (HddsDatanodeService dn : cluster.getHddsDatanodes()) { if (RatisTestHelper.isRatisFollower(dn, pipeline)) { @@ -233,10 +235,9 @@ public void testDeleteKeyWithSlowFollower() throws Exception { leader = dn; } } - Assert.assertNotNull(follower); - Assert.assertNotNull(leader); + Assume.assumeNotNull(follower, leader); //ensure that the chosen follower is still a follower - Assert.assertTrue(RatisTestHelper.isRatisFollower(follower, pipeline)); + Assume.assumeTrue(RatisTestHelper.isRatisFollower(follower, pipeline)); // shutdown the follower node cluster.shutdownHddsDatanode(follower.getDatanodeDetails()); key.write(testData);