From e972a6549946578134a4da29c5a265e2975b9e88 Mon Sep 17 00:00:00 2001 From: kkanova Date: Wed, 26 Sep 2018 14:19:50 +0200 Subject: [PATCH] Add login to oc right after OpenShiftCliCommandExecutor is initializated. --- .../cli/OpenShiftKeycloakCliCommandExecutor.java | 2 -- .../core/executor/OpenShiftCliCommandExecutor.java | 10 +++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/client/keycloak/cli/OpenShiftKeycloakCliCommandExecutor.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/client/keycloak/cli/OpenShiftKeycloakCliCommandExecutor.java index 43731cd3b892..b586a777d165 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/client/keycloak/cli/OpenShiftKeycloakCliCommandExecutor.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/client/keycloak/cli/OpenShiftKeycloakCliCommandExecutor.java @@ -49,8 +49,6 @@ public String execute(String command) throws IOException { } private void obtainKeycloakPodName() throws IOException { - openShiftCliCommandExecutor.login(); - // obtain name of keycloak pod String getKeycloakPodNameCommand = format( diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/executor/OpenShiftCliCommandExecutor.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/executor/OpenShiftCliCommandExecutor.java index d801ad5ae066..23caff1205a0 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/executor/OpenShiftCliCommandExecutor.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/core/executor/OpenShiftCliCommandExecutor.java @@ -64,14 +64,18 @@ public class OpenShiftCliCommandExecutor implements CommandExecutor { @Inject private OpenShiftWebConsoleUrlProvider openShiftWebConsoleUrlProvider; - @Override - public String execute(String command) throws IOException { + @Inject + private void postInitialization() throws IOException { if (!PATH_TO_OPENSHIFT_CLI.toFile().exists()) { downloadOpenShiftCli(); } + login(); + LOG.info("Logged into an openshift as a user: " + execute("whoami")); + } + @Override + public String execute(String command) throws IOException { String openShiftCliCommand = format("%s %s", PATH_TO_OPENSHIFT_CLI, command); - return processAgent.process(openShiftCliCommand); }