HDDS-926. Use Timeout rule for the the test methods in TestOzoneManager. Contributed by Dinesh Chitlangia.

This commit is contained in:
Bharat Viswanadham 2019-01-07 22:04:06 -08:00
parent 7f78397036
commit 4297e20c8b
1 changed files with 15 additions and 12 deletions

View File

@ -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.
* <p>
@ -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;