Skip to content

Changes to log messages into individual log file for each It class #1765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5dbc60b
adding junit-platform.properties to run IT classes in parallel
vanajamukkara Jun 12, 2020
6e51ae2
run classes in parallel
vanajamukkara Jun 12, 2020
49d0d26
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
vanajamukkara Jun 16, 2020
ebce5ea
use ThreadLocal to save the local logger
vanajamukkara Jun 19, 2020
0e5b0e3
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
vanajamukkara Jun 19, 2020
50a686c
use separate logger for each It class
vanajamukkara Jun 23, 2020
0acbe3d
echo mvn command
vanajamukkara Jun 23, 2020
ebfd264
using ThreadSafeLogger
vanajamukkara Jun 23, 2020
1418d07
fix nginx clusterrole and node port conflicts in parallel
xiancao Jun 23, 2020
326b4c7
use local var for logger
vanajamukkara Jun 24, 2020
6f3dc50
sync with latest develop
vanajamukkara Jun 24, 2020
4c13cd8
sync with latest develop
vanajamukkara Jun 24, 2020
b61390b
sync to latest develop and modify new classes for logger
vanajamukkara Jun 24, 2020
fcda3c3
fix ItDomainInPV
vanajamukkara Jun 24, 2020
54cda71
using inheritablethreadlocal
vanajamukkara Jun 24, 2020
9e8285a
Merge branch 'junit5-tests-parallel' into xc-test-parallel
vanajamukkara Jun 24, 2020
fdbce56
Merge pull request #1760 from oracle/xc-test-parallel
vanajamukkara Jun 24, 2020
159199c
fix checkstyle issue
vanajamukkara Jun 24, 2020
aa41773
commenting debug msgs
vanajamukkara Jun 25, 2020
6977645
sync with latest develop
vanajamukkara Jun 25, 2020
33cf7a9
make parallel run false by default
vanajamukkara Jun 25, 2020
7ddf816
fix merge issues
vanajamukkara Jun 25, 2020
5915a73
remove commented code, fix NPE in voyager
vanajamukkara Jun 25, 2020
bdc3012
fix merge issues
vanajamukkara Jun 25, 2020
08c58ee
sync with latest develop
vanajamukkara Jun 25, 2020
b1d03c1
addressing review comments by Xian
vanajamukkara Jun 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
sync with latest develop
  • Loading branch information
vanajamukkara committed Jun 25, 2020
commit 08c58ee7ec88626c1ca4ac99fd4c44692be5befc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import oracle.weblogic.kubernetes.annotations.tags.MustNotRunInParallel;
import oracle.weblogic.kubernetes.annotations.tags.Slow;
import oracle.weblogic.kubernetes.logging.LoggingFacade;
import oracle.weblogic.kubernetes.utils.ThreadSafeLogger;
import org.awaitility.core.ConditionFactory;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeAll;
Expand All @@ -39,6 +38,7 @@
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyOperator;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyCredentials;
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
import static org.awaitility.Awaitility.with;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -69,7 +69,7 @@ class ItMiiChangeAdminCredentials {
*/
@BeforeAll
public static void initAll(@Namespaces(2) List<String> namespaces) {
logger = ThreadSafeLogger.getLogger();
logger = getLogger();
// create standard, reusable retry/backoff policy
withStandardRetryPolicy = with().pollDelay(2, SECONDS)
.and().with().pollInterval(10, SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import oracle.weblogic.kubernetes.annotations.Namespaces;
import oracle.weblogic.kubernetes.annotations.tags.MustNotRunInParallel;
import oracle.weblogic.kubernetes.annotations.tags.Slow;
import oracle.weblogic.kubernetes.extensions.LoggedTest;
import oracle.weblogic.kubernetes.logging.LoggingFacade;
import oracle.weblogic.kubernetes.utils.CommonPatchTestUtils;
import org.awaitility.core.ConditionFactory;
import org.joda.time.DateTime;
Expand Down Expand Up @@ -42,6 +42,7 @@
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyOperator;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyCredentials;
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
import static org.awaitility.Awaitility.with;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand All @@ -53,7 +54,7 @@
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@DisplayName("Test to patch the model-in-image image to change WebLogic admin credentials secret")
@IntegrationTest
public class ItOperatorRestartWhenPodRoll implements LoggedTest {
public class ItOperatorRestartWhenPodRoll {
private static String opNamespace = null;
private static String domainNamespace = null;
private static String domainUid = "domain1";
Expand All @@ -62,6 +63,7 @@ public class ItOperatorRestartWhenPodRoll implements LoggedTest {
private static String adminServerPodName = String.format("%s-%s", domainUid, ADMIN_SERVER_NAME_BASE);
private static String managedServerPrefix = String.format("%s-%s", domainUid, MANAGED_SERVER_NAME_BASE);
private static int replicaCount = 2;
private static LoggingFacade logger = null;

/**
* Perform initialization for all the tests in this class.
Expand All @@ -73,6 +75,7 @@ public class ItOperatorRestartWhenPodRoll implements LoggedTest {
*/
@BeforeAll
public static void initAll(@Namespaces(2) List<String> namespaces) {
logger = getLogger();
// create standard, reusable retry/backoff policy
withStandardRetryPolicy = with().pollDelay(2, SECONDS)
.and().with().pollInterval(10, SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ public static boolean adminServerReady(String domainUid, String namespace) {
* @throws ApiException when query fails
*/
public static boolean isPodRestarted(
String podName, String domainUid,
String podName,
String namespace, DateTime timestamp) throws ApiException {
LoggingFacade logger = getLogger();
DateTime newCreationTime = getPodCreationTimestamp(namespace, "", podName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
package oracle.weblogic.kubernetes.utils;

import oracle.weblogic.domain.Domain;
import oracle.weblogic.kubernetes.logging.LoggingFacade;

import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_API_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.REPO_SECRET_NAME;
import static oracle.weblogic.kubernetes.extensions.LoggedTest.logger;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createDockerRegistrySecret;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createDomainAndVerify;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword;
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

/**
Expand All @@ -39,6 +40,7 @@ public static void createMiiDomainAndVerify(
String managedServerPrefix,
int replicaCount
) {
LoggingFacade logger = getLogger();
logger.info("Create the repo secret {0} to pull the image", REPO_SECRET_NAME);
assertDoesNotThrow(() -> createDockerRegistrySecret(domainNamespace),
String.format("createSecret failed for %s", REPO_SECRET_NAME));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
package oracle.weblogic.kubernetes.utils;

import io.kubernetes.client.custom.V1Patch;
import oracle.weblogic.kubernetes.logging.LoggingFacade;

import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
import static oracle.weblogic.kubernetes.actions.TestActions.getDomainCustomResource;
import static oracle.weblogic.kubernetes.actions.TestActions.patchDomainCustomResource;
import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainResourceCredentialsSecretPatched;
import static oracle.weblogic.kubernetes.assertions.TestAssertions.podRestartVersionUpdated;
import static oracle.weblogic.kubernetes.extensions.LoggedTest.logger;
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
import static org.awaitility.Awaitility.with;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -39,6 +40,7 @@ public static String patchDomainResourceWithNewAdminSecret(
String namespace,
String secretName
) {
LoggingFacade logger = getLogger();
String patch = String.format(
"[\n {\"op\": \"replace\", \"path\": \"/spec/%s\", \"value\": \"%s\"}\n]\n",
"webLogicCredentialsSecret/name", secretName);
Expand Down Expand Up @@ -106,6 +108,7 @@ public static String patchDomainWithNewSecretAndVerify(
final int replicaCount,
final String secretName
) {
LoggingFacade logger = getLogger();
logger.info(
"Patch domain resource {0} in namespace {1} to use the new secret {2}",
domainUid, namespace, secretName);
Expand Down Expand Up @@ -137,7 +140,7 @@ private static void checkDomainCredentialsSecretPatched(
String namespace,
String newValue
) {

LoggingFacade logger = getLogger();
// check if domain resource has been patched with the new secret
withStandardRetryPolicy
.conditionEvaluationListener(
Expand Down Expand Up @@ -167,6 +170,7 @@ public static void checkPodRestartVersionUpdated(
String domainUid,
String namespace,
String restartVersion) {
LoggingFacade logger = getLogger();
logger.info("Check that weblogic.domainRestartVersion of pod {0} has been updated", podName);
boolean restartVersionUpdated = assertDoesNotThrow(
() -> podRestartVersionUpdated(podName, domainUid, namespace, restartVersion),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public class CommonTestUtils {
.atMost(5, MINUTES).await();

private static ConditionFactory withQuickRetryPolicy = with().pollDelay(0, SECONDS)
.and().with().pollInterval(3, SECONDS)
.atMost(12, SECONDS).await();
.and().with().pollInterval(3, SECONDS)
.atMost(12, SECONDS).await();

/**
* Install WebLogic operator and wait up to five minutes until the operator pod is ready.
Expand Down Expand Up @@ -659,7 +659,7 @@ public static void checkPodRestarted(
domNamespace,
condition.getElapsedTimeInMS(),
condition.getRemainingTimeInMS()))
.until(assertDoesNotThrow(() -> isPodRestarted(podName, domainUid, domNamespace, lastCreationTime),
.until(assertDoesNotThrow(() -> isPodRestarted(podName, domNamespace, lastCreationTime),
String.format(
"pod %s has not been restarted in namespace %s", podName, domNamespace)));
}
Expand Down Expand Up @@ -1676,28 +1676,30 @@ public static void verifyCredentials(
String username,
String password,
boolean expectValid) {
LoggingFacade logger = getLogger();
String msg = expectValid ? "valid" : "invalid";
logger.info("Check if the given WebLogic admin credentials are {0}", msg);
withQuickRetryPolicy
.conditionEvaluationListener(
condition -> logger.info("Checking that credentials {0}/{1} are {2}"
+ "(elapsed time {3}ms, remaining time {4}ms)",
username,
password,
msg,
condition.getElapsedTimeInMS(),
condition.getRemainingTimeInMS()))
+ "(elapsed time {3}ms, remaining time {4}ms)",
username,
password,
msg,
condition.getElapsedTimeInMS(),
condition.getRemainingTimeInMS()))
.until(assertDoesNotThrow(
expectValid
?
?
() -> credentialsValid(K8S_NODEPORT_HOST, podName, namespace, username, password)
:
:
() -> credentialsNotValid(K8S_NODEPORT_HOST, podName, namespace, username, password),
String.format(
"Failed to validate credentials %s/%s on pod %s in namespace %s",
username, password, podName, namespace)));
"Failed to validate credentials %s/%s on pod %s in namespace %s",
username, password, podName, namespace)));
}


/**
* Generate a text file in RESULTS_ROOT directory by replacing template value.
* @param inputTemplateFile input template file
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.