HDDS-1254. Fix failure in TestOzoneManagerHttpServer & TestStorageContainerManagerHttpServer. Contributed by Ajay Kumar. (#598)

This commit is contained in:
Ajay Yadav 2019-03-13 12:01:08 -07:00 committed by GitHub
parent 86d508c7c7
commit 4fa009989b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -106,13 +106,15 @@ public class TestStorageContainerManagerHttpServer {
Assert.assertTrue(implies(policy.isHttpEnabled(),
canAccess("http", server.getHttpAddress())));
Assert.assertTrue(
implies(!policy.isHttpEnabled(), server.getHttpAddress() == null));
Assert.assertTrue(implies(policy.isHttpEnabled() &&
!policy.isHttpsEnabled(),
!canAccess("https", server.getHttpsAddress())));
Assert.assertTrue(implies(policy.isHttpsEnabled(),
canAccess("https", server.getHttpsAddress())));
Assert.assertTrue(
implies(!policy.isHttpsEnabled(), server.getHttpsAddress() == null));
Assert.assertTrue(implies(policy.isHttpsEnabled() &&
!policy.isHttpEnabled(),
!canAccess("http", server.getHttpAddress())));
} finally {
if (server != null) {

View File

@ -95,8 +95,8 @@ public class TestOzoneManagerHttpServer {
@Test public void testHttpPolicy() throws Exception {
conf.set(DFSConfigKeys.DFS_HTTP_POLICY_KEY, policy.name());
conf.set(ScmConfigKeys.OZONE_SCM_HTTPS_ADDRESS_KEY, "localhost:0");
InetSocketAddress addr = InetSocketAddress.createUnresolved("localhost", 0);
OzoneManagerHttpServer server = null;
try {
server = new OzoneManagerHttpServer(conf, null);
@ -104,13 +104,14 @@ public class TestOzoneManagerHttpServer {
Assert.assertTrue(implies(policy.isHttpEnabled(),
canAccess("http", server.getHttpAddress())));
Assert.assertTrue(
implies(!policy.isHttpEnabled(), server.getHttpAddress() == null));
Assert.assertTrue(implies(policy.isHttpEnabled() &&
!policy.isHttpsEnabled(),
!canAccess("https", server.getHttpsAddress())));
Assert.assertTrue(implies(policy.isHttpsEnabled(),
canAccess("https", server.getHttpsAddress())));
Assert.assertTrue(
implies(!policy.isHttpsEnabled(), server.getHttpsAddress() == null));
Assert.assertTrue(implies(policy.isHttpsEnabled(),
!canAccess("http", server.getHttpsAddress())));
} finally {
if (server != null) {