DBZ-5165 changed logging for isRunningFromOcp conditions

This commit is contained in:
Martin Medek 2022-06-06 15:36:13 +02:00 committed by Jakub Cechacek
parent 5614712628
commit 3d313a621f
3 changed files with 7 additions and 14 deletions

View File

@ -254,19 +254,6 @@ public void waitForPods(String project, Map<String, String> labels) {
// TODO not sure if it should be here
public static boolean isRunningFromOcp() {
LOGGER.info("===========================================================");
LOGGER.info("===========================================================");
LOGGER.info("===========================================================");
LOGGER.info("== URL: " + ConfigProperties.OCP_URL.orElse("") + "=======================================");
LOGGER.info("== URL: " + ConfigProperties.OCP_USERNAME.orElse("") + "=======================================");
LOGGER.info("== URL: " + ConfigProperties.OCP_PASSWORD.orElse("") + "=======================================");
LOGGER.info("===========================================================");
LOGGER.info("===========================================================");
LOGGER.info("===========================================================");
return ConfigProperties.OCP_URL.isEmpty() ||
ConfigProperties.OCP_USERNAME.isEmpty() ||
ConfigProperties.OCP_PASSWORD.isEmpty();

View File

@ -47,9 +47,12 @@ public AbstractOcpDatabaseController(
}
private Service getLoadBalancedService() {
// TODO this probably isn't necessary
if (isRunningFromOcp()) {
LOGGER.info("getLoadBalancedService: running from OCP, returning local service");
return getService();
}
LOGGER.info("getLoadBalancedService: not running from OCP, returning LB service");
return ocp
.services()
.inNamespace(project)
@ -102,6 +105,7 @@ public int getDatabasePort() {
@Override
public String getPublicDatabaseHostname() {
if (isRunningFromOcp()) {
LOGGER.info("Running from OCP, using local database hostname");
return getDatabaseHostname();
}
awaitIngress();
@ -112,6 +116,7 @@ public String getPublicDatabaseHostname() {
@Override
public int getPublicDatabasePort() {
if (isRunningFromOcp()) {
LOGGER.info("Running from OCP, using local database port");
return getDatabasePort();
}
awaitIngress();

View File

@ -30,7 +30,8 @@ public OcpMySql(ExtensionContext.Store store) {
@Override
protected SqlDatabaseController databaseController() throws Exception {
Class.forName("com.mysql.cj.jdbc.Driver");
String[] services = isRunningFromOcp() ? new String[]{DB_SERVICE_PATH} : new String[]{DB_SERVICE_PATH, DB_SERVICE_PATH_LB};
// String[] services = isRunningFromOcp() ? new String[]{DB_SERVICE_PATH} : new String[]{DB_SERVICE_PATH, DB_SERVICE_PATH_LB};
String[] services = new String[]{DB_SERVICE_PATH, DB_SERVICE_PATH_LB};
OcpMySqlDeployer deployer = new OcpMySqlDeployer.Deployer()
.withOcpClient(ocp)