1
- // Copyright (c) 2020, 2023 , Oracle and/or its affiliates.
1
+ // Copyright (c) 2020, 2024 , Oracle and/or its affiliates.
2
2
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
3
4
4
package oracle .weblogic .kubernetes ;
5
5
6
+ import java .net .InetAddress ;
6
7
import java .nio .file .Files ;
7
8
import java .nio .file .Path ;
8
9
import java .nio .file .Paths ;
49
50
import static oracle .weblogic .kubernetes .TestConstants .DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX ;
50
51
import static oracle .weblogic .kubernetes .TestConstants .DOMAIN_API_VERSION ;
51
52
import static oracle .weblogic .kubernetes .TestConstants .DOMAIN_STATUS_CONDITION_COMPLETED_TYPE ;
53
+ import static oracle .weblogic .kubernetes .TestConstants .DOMAIN_VERSION ;
52
54
import static oracle .weblogic .kubernetes .TestConstants .ENCRYPION_PASSWORD_DEFAULT ;
53
55
import static oracle .weblogic .kubernetes .TestConstants .ENCRYPION_USERNAME_DEFAULT ;
54
56
import static oracle .weblogic .kubernetes .TestConstants .K8S_NODEPORT_HOST ;
57
+ import static oracle .weblogic .kubernetes .TestConstants .KIND_CLUSTER ;
55
58
import static oracle .weblogic .kubernetes .TestConstants .KUBERNETES_CLI ;
56
59
import static oracle .weblogic .kubernetes .TestConstants .MII_AUXILIARY_IMAGE_NAME ;
57
60
import static oracle .weblogic .kubernetes .TestConstants .MII_BASIC_APP_NAME ;
63
66
import static oracle .weblogic .kubernetes .TestConstants .SKIP_CLEANUP ;
64
67
import static oracle .weblogic .kubernetes .TestConstants .SSL_PROPERTIES ;
65
68
import static oracle .weblogic .kubernetes .TestConstants .TEST_IMAGES_REPO_SECRET_NAME ;
69
+ import static oracle .weblogic .kubernetes .TestConstants .TRAEFIK_INGRESS_HTTP_HOSTPORT ;
66
70
import static oracle .weblogic .kubernetes .TestConstants .WDT_BASIC_IMAGE_NAME ;
67
71
import static oracle .weblogic .kubernetes .TestConstants .WDT_BASIC_IMAGE_TAG ;
68
72
import static oracle .weblogic .kubernetes .TestConstants .WEBLOGIC_IMAGE_TO_USE_IN_SPEC ;
73
+ import static oracle .weblogic .kubernetes .TestConstants .WLSIMG_BUILDER ;
74
+ import static oracle .weblogic .kubernetes .TestConstants .WLSIMG_BUILDER_DEFAULT ;
69
75
import static oracle .weblogic .kubernetes .actions .ActionConstants .ARCHIVE_DIR ;
70
76
import static oracle .weblogic .kubernetes .actions .ActionConstants .MODEL_DIR ;
71
77
import static oracle .weblogic .kubernetes .actions .ActionConstants .RESOURCE_DIR ;
77
83
import static oracle .weblogic .kubernetes .utils .ApplicationUtils .collectAppAvailability ;
78
84
import static oracle .weblogic .kubernetes .utils .ApplicationUtils .deployAndAccessApplication ;
79
85
import static oracle .weblogic .kubernetes .utils .ApplicationUtils .verifyAdminConsoleAccessible ;
86
+ import static oracle .weblogic .kubernetes .utils .ApplicationUtils .verifyAdminServerRESTAccess ;
80
87
import static oracle .weblogic .kubernetes .utils .AuxiliaryImageUtils .createPushAuxiliaryImageWithDomainConfig ;
81
88
import static oracle .weblogic .kubernetes .utils .CommonMiiTestUtils .verifyPodsNotRolled ;
82
89
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkServiceExists ;
90
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createIngressHostRouting ;
91
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .formatIPv6Host ;
83
92
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getNextFreePort ;
84
- import static oracle .weblogic .kubernetes .utils .CommonTestUtils .startPortForwardProcess ;
85
- import static oracle .weblogic .kubernetes .utils .CommonTestUtils .stopPortForwardProcess ;
86
93
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .testUntil ;
87
94
import static oracle .weblogic .kubernetes .utils .DomainUtils .verifyDomainStatusConditionTypeDoesNotExist ;
88
95
import static oracle .weblogic .kubernetes .utils .FileUtils .generateFileFromTemplate ;
@@ -124,7 +131,9 @@ class ItOperatorWlsUpgrade {
124
131
125
132
private static LoggingFacade logger = null ;
126
133
private String domainUid = "domain1" ;
127
- private String adminServerPodName = domainUid + "-admin-server" ;
134
+ private String adminServerName = "admin-server" ;
135
+ private int adminPort = 7001 ;
136
+ private String adminServerPodName = domainUid + "-" + adminServerName ;
128
137
private String managedServerPodNamePrefix = domainUid + "-managed-server" ;
129
138
private int replicaCount = 2 ;
130
139
private List <String > namespaces ;
@@ -137,6 +146,7 @@ class ItOperatorWlsUpgrade {
137
146
private Path destDomainYaml = null ;
138
147
private static String miiAuxiliaryImageTag = "aux-explict-upgrade" ;
139
148
private static final String miiAuxiliaryImage = MII_AUXILIARY_IMAGE_NAME + ":" + miiAuxiliaryImageTag ;
149
+ private static String hostHeader ;
140
150
141
151
/**
142
152
* For each test:
@@ -174,71 +184,106 @@ void testOperatorWlsUpgradeFrom338ToCurrent(String domainType) {
174
184
}
175
185
176
186
/**
177
- * Operator upgrade from 3.4.8 to current.
187
+ * Operator upgrade from 3.4.12 to current.
178
188
*/
179
189
@ ParameterizedTest
180
- @ DisplayName ("Upgrade Operator from 3.4.8 to current" )
190
+ @ DisplayName ("Upgrade Operator from 3.4.12 to current" )
181
191
@ ValueSource (strings = { "Image" , "FromModel" })
182
- void testOperatorWlsUpgradeFrom348ToCurrent (String domainType ) {
183
- logger .info ("Starting test testOperatorWlsUpgradeFrom348ToCurrent with domain type {0}" , domainType );
184
- installAndUpgradeOperator (domainType , "3.4.8 " , OLD_DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
192
+ void testOperatorWlsUpgradeFrom3412ToCurrent (String domainType ) {
193
+ logger .info ("Starting test testOperatorWlsUpgradeFrom3412ToCurrent with domain type {0}" , domainType );
194
+ installAndUpgradeOperator (domainType , "3.4.12 " , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
185
195
}
186
196
187
197
/**
188
- * Operator upgrade from 3.4.9 to current.
198
+ * Operator upgrade from 3.4.13 to current.
189
199
*/
190
200
@ ParameterizedTest
191
- @ DisplayName ("Upgrade Operator from 3.4.9 to current" )
201
+ @ DisplayName ("Upgrade Operator from 3.4.13 to current" )
192
202
@ ValueSource (strings = { "Image" , "FromModel" })
193
- void testOperatorWlsUpgradeFrom349ToCurrent (String domainType ) {
194
- logger .info ("Starting test testOperatorWlsUpgradeFrom346ToCurrent with domain type {0}" , domainType );
195
- installAndUpgradeOperator (domainType , "3.4.9 " , OLD_DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
203
+ void testOperatorWlsUpgradeFrom3413ToCurrent (String domainType ) {
204
+ logger .info ("Starting test testOperatorWlsUpgradeFrom3413ToCurrent with domain type {0}" , domainType );
205
+ installAndUpgradeOperator (domainType , "3.4.13 " , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
196
206
}
197
207
208
+
209
+ /**
210
+ * Operator upgrade from 4.0.8 to current.
211
+ */
212
+ @ ParameterizedTest
213
+ @ DisplayName ("Upgrade Operator from 4.0.8 to current" )
214
+ @ ValueSource (strings = { "Image" , "FromModel" })
215
+ void testOperatorWlsUpgradeFrom408ToCurrent (String domainType ) {
216
+ logger .info ("Starting test testOperatorWlsUpgradeFrom408ToCurrent with domain type {0}" , domainType );
217
+ installAndUpgradeOperator (domainType , "4.0.8" , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
218
+ }
219
+
198
220
/**
199
- * Operator upgrade from 4.0.7 to current.
221
+ * Operator upgrade from 4.0.9 to current.
200
222
*/
201
223
@ ParameterizedTest
202
- @ DisplayName ("Upgrade Operator from 4.0.7 to current" )
224
+ @ DisplayName ("Upgrade Operator from 4.0.9 to current" )
203
225
@ ValueSource (strings = { "Image" , "FromModel" })
204
- void testOperatorWlsUpgradeFrom407ToCurrent (String domainType ) {
205
- logger .info ("Starting test testOperatorWlsUpgradeFrom407ToCurrent with domain type {0}" , domainType );
206
- installAndUpgradeOperator (domainType , "4.0.7 " , OLD_DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
226
+ void testOperatorWlsUpgradeFrom409ToCurrent (String domainType ) {
227
+ logger .info ("Starting test testOperatorWlsUpgradeFrom409ToCurrent with domain type {0}" , domainType );
228
+ installAndUpgradeOperator (domainType , "4.0.9 " , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
207
229
}
208
230
209
231
/**
210
- * Operator upgrade from 4.0.8 to current.
232
+ * Operator upgrade from 4.0.10 to current.
211
233
*/
212
234
@ ParameterizedTest
213
- @ DisplayName ("Upgrade Operator from 4.0.8 to current" )
235
+ @ DisplayName ("Upgrade Operator from 4.0.10 to current" )
214
236
@ ValueSource (strings = { "Image" , "FromModel" })
215
- void testOperatorWlsUpgradeFrom406ToCurrent (String domainType ) {
216
- logger .info ("Starting test testOperatorWlsUpgradeFrom408ToCurrent with domain type {0}" , domainType );
217
- installAndUpgradeOperator (domainType , "4.0.8 " , OLD_DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
237
+ void testOperatorWlsUpgradeFrom4010ToCurrent (String domainType ) {
238
+ logger .info ("Starting test testOperatorWlsUpgradeFrom4010ToCurrent with domain type {0}" , domainType );
239
+ installAndUpgradeOperator (domainType , "4.0.10 " , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
218
240
}
241
+
219
242
220
243
/**
221
- * Operator upgrade from 4.1.0 to current.
244
+ * Operator upgrade from 4.1.7 to current.
222
245
*/
223
246
@ ParameterizedTest
224
- @ DisplayName ("Upgrade Operator from 4.1.0 to current" )
247
+ @ DisplayName ("Upgrade Operator from 4.1.7 to current" )
225
248
@ ValueSource (strings = { "Image" , "FromModel" })
226
- void testOperatorWlsUpgradeFrom410ToCurrent (String domainType ) {
227
- logger .info ("Starting test testOperatorWlsUpgradeFrom410ToCurrent with domain type {0}" , domainType );
228
- installAndUpgradeOperator (domainType , "4.1.0 " , OLD_DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
249
+ void testOperatorWlsUpgradeFrom417ToCurrent (String domainType ) {
250
+ logger .info ("Starting test testOperatorWlsUpgradeFrom417ToCurrent with domain type {0}" , domainType );
251
+ installAndUpgradeOperator (domainType , "4.1.7 " , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
229
252
}
230
253
231
254
/**
232
- * Operator upgrade from 4.1.1 to current.
255
+ * Operator upgrade from 4.1.8 to current.
233
256
*/
234
257
@ ParameterizedTest
235
- @ DisplayName ("Upgrade Operator from 4.1.1 to current" )
258
+ @ DisplayName ("Upgrade Operator from 4.1.8 to current" )
236
259
@ ValueSource (strings = { "Image" , "FromModel" })
237
- void testOperatorWlsUpgradeFrom411ToCurrent (String domainType ) {
238
- logger .info ("Starting test testOperatorWlsUpgradeFrom411ToCurrent with domain type {0}" , domainType );
239
- installAndUpgradeOperator (domainType , "4.1.1 " , OLD_DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
260
+ void testOperatorWlsUpgradeFrom418ToCurrent (String domainType ) {
261
+ logger .info ("Starting test testOperatorWlsUpgradeFrom418ToCurrent with domain type {0}" , domainType );
262
+ installAndUpgradeOperator (domainType , "4.1.8 " , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
240
263
}
241
264
265
+ /**
266
+ * Operator upgrade from 4.2.2 to current.
267
+ */
268
+ @ ParameterizedTest
269
+ @ DisplayName ("Upgrade Operator from 4.2.2 to current" )
270
+ @ ValueSource (strings = {"Image" , "FromModel" })
271
+ void testOperatorWlsUpgradeFrom422ToCurrent (String domainType ) {
272
+ logger .info ("Starting test testOperatorWlsUpgradeFrom422ToCurrent with domain type {0}" , domainType );
273
+ installAndUpgradeOperator (domainType , "4.2.2" , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
274
+ }
275
+
276
+ /**
277
+ * Operator upgrade from 4.2.3 to current.
278
+ */
279
+ @ ParameterizedTest
280
+ @ DisplayName ("Upgrade Operator from 4.2.3 to current" )
281
+ @ ValueSource (strings = {"Image" , "FromModel" })
282
+ void testOperatorWlsUpgradeFrom423ToCurrent (String domainType ) {
283
+ logger .info ("Starting test testOperatorWlsUpgradeFrom423ToCurrent with domain type {0}" , domainType );
284
+ installAndUpgradeOperator (domainType , "4.2.3" , DOMAIN_VERSION , DEFAULT_EXTERNAL_SERVICE_NAME_SUFFIX );
285
+ }
286
+
242
287
/**
243
288
* Auxiliary Image Domain upgrade from Operator 3.4.1 to current.
244
289
*/
@@ -661,26 +706,6 @@ private void removePortForwardingAttribute(
661
706
boolean result = Command .withParams (params ).execute ();
662
707
}
663
708
664
- private void checkAdminPortForwarding (String domainNamespace , boolean successExpected ) {
665
-
666
- logger .info ("Checking port forwarding [{0}]" , successExpected );
667
- String forwardPort =
668
- startPortForwardProcess ("localhost" , domainNamespace ,
669
- domainUid , 7001 );
670
- assertNotNull (forwardPort , "port-forward fails to assign local port" );
671
- logger .info ("Forwarded admin-port is {0}" , forwardPort );
672
- if (successExpected ) {
673
- verifyAdminConsoleAccessible (domainNamespace , "localhost" ,
674
- forwardPort , false );
675
- logger .info ("ready app is accessible thru port forwarding" );
676
- } else {
677
- verifyAdminConsoleAccessible (domainNamespace , "localhost" ,
678
- forwardPort , false , false );
679
- logger .info ("WebLogic console shouldn't accessible thru port forwarding" );
680
- }
681
- stopPortForwardProcess (domainNamespace );
682
- }
683
-
684
709
/**
685
710
* Replace the fields in domain yaml file with testing attributes.
686
711
* For example, namespace, domainUid, and image. Then create domain using
@@ -754,17 +779,23 @@ private void createWlsDomainAndVerifyByDomainYaml(String domainType,
754
779
private void verifyDomain (String domainUidString , String domainNamespace , String externalServiceNameSuffix ) {
755
780
756
781
checkDomainStarted (domainUid , domainNamespace );
782
+
783
+ if (KIND_CLUSTER && !WLSIMG_BUILDER .equals (WLSIMG_BUILDER_DEFAULT )) {
784
+ hostHeader = createIngressHostRouting (domainNamespace , domainUidString , adminServerName , adminPort );
785
+ assertDoesNotThrow (() -> verifyAdminServerRESTAccess (formatIPv6Host (InetAddress .getLocalHost ().getHostAddress ()),
786
+ TRAEFIK_INGRESS_HTTP_HOSTPORT , false , hostHeader ));
787
+ }
757
788
758
- logger . info ( "Getting node port for default channel" );
759
- int serviceNodePort = assertDoesNotThrow (() -> getServiceNodePort (
760
- domainNamespace , getExternalServicePodName ( adminServerPodName , externalServiceNameSuffix ), "default" ),
761
- "Getting admin server node port failed" );
762
- logger . info ( "Got node port {0} for default channel for domainNameSpace {1}" , serviceNodePort , domainNamespace );
763
-
764
- logger .info ("Validating WebLogic admin server access by login to console" );
765
- verifyAdminConsoleAccessible (domainNamespace , K8S_NODEPORT_HOST ,
766
- String .valueOf (serviceNodePort ), false );
767
-
789
+ if ( WLSIMG_BUILDER . equals ( WLSIMG_BUILDER_DEFAULT )) {
790
+ logger . info ( "Getting node port for default channel" );
791
+ int serviceNodePort = assertDoesNotThrow (() -> getServiceNodePort (
792
+ domainNamespace , getExternalServicePodName ( adminServerPodName , externalServiceNameSuffix ), "default" ),
793
+ "Getting admin server node port failed" );
794
+ logger . info ( "Got node port {0} for default channel for domainNameSpace {1}" , serviceNodePort , domainNamespace );
795
+ logger .info ("Validating WebLogic admin server access by login to console" );
796
+ verifyAdminConsoleAccessible (domainNamespace , K8S_NODEPORT_HOST ,
797
+ String .valueOf (serviceNodePort ), false );
798
+ }
768
799
}
769
800
770
801
}
0 commit comments