|
5 | 5 |
|
6 | 6 | import java.io.File; |
7 | 7 | import java.io.FileOutputStream; |
8 | | -import java.lang.annotation.ElementType; |
9 | | -import java.lang.annotation.Retention; |
10 | | -import java.lang.annotation.RetentionPolicy; |
11 | | -import java.lang.annotation.Target; |
12 | 8 | import java.net.http.HttpResponse; |
13 | 9 | import java.nio.file.Files; |
14 | 10 | import java.nio.file.Path; |
|
61 | 57 | import org.junit.jupiter.api.Tag; |
62 | 58 | import org.junit.jupiter.api.Test; |
63 | 59 | import org.junit.jupiter.api.TestMethodOrder; |
64 | | -import org.junit.jupiter.api.extension.ConditionEvaluationResult; |
65 | | -import org.junit.jupiter.api.extension.ExecutionCondition; |
66 | | -import org.junit.jupiter.api.extension.ExtendWith; |
67 | | -import org.junit.jupiter.api.extension.ExtensionContext; |
68 | 60 |
|
69 | 61 | import static java.util.concurrent.TimeUnit.MINUTES; |
70 | 62 | import static java.util.concurrent.TimeUnit.SECONDS; |
|
78 | 70 | import static oracle.weblogic.kubernetes.TestConstants.KIND_REPO; |
79 | 71 | import static oracle.weblogic.kubernetes.TestConstants.OKD; |
80 | 72 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME; |
81 | | -import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG; |
82 | 73 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC; |
83 | | -import static oracle.weblogic.kubernetes.TestConstants.WLS_LATEST_IMAGE_TAG; |
84 | | -import static oracle.weblogic.kubernetes.TestConstants.WLS_UPDATE_IMAGE_TAG; |
85 | 74 | import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR; |
86 | 75 | import static oracle.weblogic.kubernetes.actions.ActionConstants.ITTESTS_DIR; |
87 | 76 | import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR; |
@@ -972,10 +961,8 @@ void testCreateNewCluster() { |
972 | 961 | * To: "image:container-registry.oracle.com/middleware/weblogic:2021-07-08-162571383699" |
973 | 962 | * Verify all the pods are restarted and back to ready state |
974 | 963 | * Verify the admin server is accessible and cluster members are healthy |
975 | | - * This test will be skipped if the image tag is the latest WebLogic image tag |
976 | 964 | */ |
977 | 965 | @Order(5) |
978 | | - @AssumeWebLogicImage |
979 | 966 | @Test |
980 | 967 | @DisplayName("Verify server pods are restarted by updating image name") |
981 | 968 | void testUpdateImageName() { |
@@ -1380,42 +1367,6 @@ public void tearDownAll() { |
1380 | 1367 | } |
1381 | 1368 | } |
1382 | 1369 |
|
1383 | | - /** |
1384 | | - * JUnit5 extension class to implement ExecutionCondition for the custom |
1385 | | - * annotation @AssumeWebLogicImage. |
1386 | | - */ |
1387 | | - private static class WebLogicImageCondition implements ExecutionCondition { |
1388 | | - |
1389 | | - /** |
1390 | | - * Determine if the the test "testUpdateImageName" will be skipped based on WebLogic image tag. |
1391 | | - * Skip the test if the image tag is the latest one. |
1392 | | - * |
1393 | | - * @param context the current extension context |
1394 | | - * @return ConditionEvaluationResult disabled if the image tag is the latest one, enabled if the |
1395 | | - * image tag is not the latest one |
1396 | | - */ |
1397 | | - @Override |
1398 | | - public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { |
1399 | | - if (WEBLOGIC_IMAGE_TAG.equals(WLS_LATEST_IMAGE_TAG)) { |
1400 | | - getLogger().info("WebLogic image tag is {0}. No latest image available to continue test. Skipping test", |
1401 | | - WLS_LATEST_IMAGE_TAG); |
1402 | | - return ConditionEvaluationResult |
1403 | | - .disabled(String.format("No latest image available to continue test. Skipping test!")); |
1404 | | - } else { |
1405 | | - getLogger().info("Updating image to {0}. Continuing test!", WLS_UPDATE_IMAGE_TAG); |
1406 | | - return ConditionEvaluationResult |
1407 | | - .enabled(String.format("Updating image to {0}. Continuing test!", WLS_UPDATE_IMAGE_TAG)); |
1408 | | - } |
1409 | | - } |
1410 | | - } |
1411 | | - |
1412 | | - @Target({ElementType.TYPE, ElementType.METHOD}) |
1413 | | - @Retention(RetentionPolicy.RUNTIME) |
1414 | | - @Tag("assume-weblogic-image") |
1415 | | - @ExtendWith(WebLogicImageCondition.class) |
1416 | | - @interface AssumeWebLogicImage { |
1417 | | - } |
1418 | | - |
1419 | 1370 | // copy samples directory to a temporary location |
1420 | 1371 | private static void setupSample() { |
1421 | 1372 | assertDoesNotThrow(() -> { |
|
0 commit comments