From 4297e20c8baaa423ba27eeb70efb35e4c20aac15 Mon Sep 17 00:00:00 2001 From: Bharat Viswanadham Date: Mon, 7 Jan 2019 22:04:06 -0800 Subject: [PATCH] HDDS-926. Use Timeout rule for the the test methods in TestOzoneManager. Contributed by Dinesh Chitlangia. --- .../hadoop/ozone/om/TestOzoneManager.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java index 84c54309b75..26c2a58c6ee 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java @@ -70,7 +70,7 @@ import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; - +import org.junit.rules.Timeout; import java.io.IOException; import java.io.InputStream; @@ -110,6 +110,9 @@ public class TestOzoneManager { @Rule public ExpectedException exception = ExpectedException.none(); + @Rule + public Timeout timeout = new Timeout(60000); + /** * Create a MiniDFSCluster for testing. *

@@ -148,7 +151,7 @@ public class TestOzoneManager { } // Create a volume and test its attribute after creating them - @Test(timeout = 60000) + @Test public void testCreateVolume() throws IOException, OzoneException { long volumeCreateFailCount = omMetrics.getNumVolumeCreateFails(); String userName = "user" + RandomStringUtils.randomNumeric(5); @@ -169,7 +172,7 @@ public class TestOzoneManager { } // Create a volume and modify the volume owner and then test its attributes - @Test(timeout = 60000) + @Test public void testChangeVolumeOwner() throws IOException, OzoneException { long volumeCreateFailCount = omMetrics.getNumVolumeCreateFails(); long volumeInfoFailCount = omMetrics.getNumVolumeInfoFails(); @@ -199,7 +202,7 @@ public class TestOzoneManager { } // Create a volume and modify the volume owner and then test its attributes - @Test(timeout = 60000) + @Test public void testChangeVolumeQuota() throws IOException, OzoneException { long numVolumeCreateFail = omMetrics.getNumVolumeCreateFails(); long numVolumeInfoFail = omMetrics.getNumVolumeInfoFails(); @@ -245,7 +248,7 @@ public class TestOzoneManager { } // Create a volume and then delete it and then check for deletion - @Test(timeout = 60000) + @Test public void testDeleteVolume() throws IOException, OzoneException { long volumeCreateFailCount = omMetrics.getNumVolumeCreateFails(); String userName = "user" + RandomStringUtils.randomNumeric(5); @@ -309,7 +312,7 @@ public class TestOzoneManager { // Create a volume and a bucket inside the volume, // then delete it and then check for deletion failure - @Test(timeout = 60000) + @Test public void testFailedDeleteVolume() throws IOException, OzoneException { long numVolumeCreateFails = omMetrics.getNumVolumeCreateFails(); String userName = "user" + RandomStringUtils.randomNumeric(5); @@ -346,7 +349,7 @@ public class TestOzoneManager { } // Create a volume and test Volume access for a different user - @Test(timeout = 60000) + @Test public void testAccessVolume() throws IOException, OzoneException { String userName = "user" + RandomStringUtils.randomNumeric(5); String adminName = "admin" + RandomStringUtils.randomNumeric(5); @@ -390,7 +393,7 @@ public class TestOzoneManager { Assert.assertEquals(0, omMetrics.getNumVolumeCreateFails()); } - @Test(timeout = 60000) + @Test public void testCreateBucket() throws IOException, OzoneException { long numVolumeCreateFail = omMetrics.getNumVolumeCreateFails(); long numBucketCreateFail = omMetrics.getNumBucketCreateFails(); @@ -421,7 +424,7 @@ public class TestOzoneManager { omMetrics.getNumBucketInfoFails()); } - @Test(timeout = 60000) + @Test public void testDeleteBucket() throws IOException, OzoneException { String userName = "user" + RandomStringUtils.randomNumeric(5); String adminName = "admin" + RandomStringUtils.randomNumeric(5); @@ -444,7 +447,7 @@ public class TestOzoneManager { storageHandler.getBucketInfo(getBucketArgs); } - @Test(timeout = 60000) + @Test public void testDeleteNonExistingBucket() throws IOException, OzoneException { String userName = "user" + RandomStringUtils.randomNumeric(5); String adminName = "admin" + RandomStringUtils.randomNumeric(5); @@ -469,7 +472,7 @@ public class TestOzoneManager { } - @Test(timeout = 60000) + @Test public void testDeleteNonEmptyBucket() throws IOException, OzoneException { String userName = "user" + RandomStringUtils.randomNumeric(5); String adminName = "admin" + RandomStringUtils.randomNumeric(5); @@ -791,7 +794,7 @@ public class TestOzoneManager { omMetrics.getNumKeyRenameFails()); } - @Test(timeout = 60000) + @Test public void testListBuckets() throws IOException, OzoneException { ListBuckets result = null; ListArgs listBucketArgs = null;