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(), Assert.assertTrue(implies(policy.isHttpEnabled(),
canAccess("http", server.getHttpAddress()))); canAccess("http", server.getHttpAddress())));
Assert.assertTrue( Assert.assertTrue(implies(policy.isHttpEnabled() &&
implies(!policy.isHttpEnabled(), server.getHttpAddress() == null)); !policy.isHttpsEnabled(),
!canAccess("https", server.getHttpsAddress())));
Assert.assertTrue(implies(policy.isHttpsEnabled(), Assert.assertTrue(implies(policy.isHttpsEnabled(),
canAccess("https", server.getHttpsAddress()))); canAccess("https", server.getHttpsAddress())));
Assert.assertTrue( Assert.assertTrue(implies(policy.isHttpsEnabled() &&
implies(!policy.isHttpsEnabled(), server.getHttpsAddress() == null)); !policy.isHttpEnabled(),
!canAccess("http", server.getHttpAddress())));
} finally { } finally {
if (server != null) { if (server != null) {

View File

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