Skip to content

Commit f48f793

Browse files
committed
Backport test stability changes
1 parent a98618a commit f48f793

File tree

7 files changed

+36
-48
lines changed

7 files changed

+36
-48
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItInitContainers.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
3737
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE;
3838
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
39+
import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_IMAGE;
40+
import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_TAG;
3941
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_API_VERSION;
4042
import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE;
4143
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_NAME;
@@ -189,13 +191,13 @@ void testDomainInitContainer() {
189191
//check if init container got executed in the server pods
190192
assertTrue(checkPodLogContainMsg(domain1Uid + "-admin-server",domain1Namespace,
191193
domain1Uid,"Hi from Domain"),
192-
"failed to init busybox container command for admin server");
194+
"failed to init init-container container command for admin server");
193195
assertTrue(checkPodLogContainMsg(domain1Uid + "-managed-server1",domain1Namespace,
194196
domain1Uid, "Hi from Domain"),
195-
"failed to init busybox container command for managed server1");
197+
"failed to init init-container container command for managed server1");
196198
assertTrue(checkPodLogContainMsg(domain1Uid + "-managed-server2",domain1Namespace,
197199
domain1Uid,"Hi from Domain"),
198-
"failed to init busybox container command for managed server2");
200+
"failed to init init-container container command for managed server2");
199201

200202
// get the pod creation time stamps
201203
LinkedHashMap<String, OffsetDateTime> pods = new LinkedHashMap<>();
@@ -223,7 +225,7 @@ private boolean checkPodLogContainMsg(String podName, String podNamespace, Strin
223225
logger.info("Checking that pod {0} exists in namespace {1}",
224226
podName, podNamespace);
225227
checkPodReady(podName, domainUid, podNamespace);
226-
podLog = getPodLog(podName, podNamespace,"busybox");
228+
podLog = getPodLog(podName, podNamespace,"init-container");
227229
} catch (Exception ex) {
228230
logger.info("Caught unexpected exception while calling getPodLog for pod "
229231
+ podName
@@ -253,9 +255,9 @@ void testAdminServerInitContainer() {
253255
"can't start or verify domain in namespace " + domain2Namespace);
254256

255257
//check if init container got executed for admin server pod
256-
assertTrue(assertDoesNotThrow(() -> getPodLog(domain2Uid + "-admin-server", domain2Namespace,"busybox")
258+
assertTrue(assertDoesNotThrow(() -> getPodLog(domain2Uid + "-admin-server", domain2Namespace,"init-container")
257259
.contains("Hi from AdminServer"),
258-
"failed to init busybox container command for admin server"));
260+
"failed to init init-container container command for admin server"));
259261
}
260262

261263
/**
@@ -272,11 +274,11 @@ void testClusterInitContainer() {
272274

273275
//check if init container got executed
274276
assertTrue(assertDoesNotThrow(() -> getPodLog(domain3Uid + "-managed-server1",
275-
domain3Namespace,"busybox").contains("Hi from Cluster"),
276-
"failed to init busybox container command for cluster's managed-server1"));
277+
domain3Namespace,"init-container").contains("Hi from Cluster"),
278+
"failed to init init-container container command for cluster's managed-server1"));
277279
assertTrue(assertDoesNotThrow(() -> getPodLog(domain3Uid + "-managed-server2",
278-
domain3Namespace,"busybox").contains("Hi from Cluster"),
279-
"failed to init busybox container command for cluster's managed-server2"));
280+
domain3Namespace,"init-container").contains("Hi from Cluster"),
281+
"failed to init init-container container command for cluster's managed-server2"));
280282
}
281283

282284
/**
@@ -292,9 +294,9 @@ void testMsInitContainer() {
292294
"can't start or verify domain in namespace " + domain4Namespace);
293295

294296
//check if init container got executed
295-
assertTrue(assertDoesNotThrow(() -> getPodLog(domain4Uid + "-managed-server1", domain4Namespace,"busybox")
297+
assertTrue(assertDoesNotThrow(() -> getPodLog(domain4Uid + "-managed-server1", domain4Namespace,"init-container")
296298
.contains("Hi from managed-server1"),
297-
"failed to init busybox container command for managed server1"));
299+
"failed to init init-container container command for managed server1"));
298300
}
299301

300302
private boolean createVerifyDomain(String domainNamespace, String domainUid, String parentNodeName) {
@@ -363,9 +365,9 @@ private void createAndVerifyMiiDomain(String domainNamespace, String domainUid,
363365
case "spec":
364366
domain.getSpec().getServerPod().addInitContainersItem(new V1Container()
365367
.addCommandItem("echo").addArgsItem("\"Hi from Domain\"")
366-
.name("busybox")
368+
.name("init-container")
367369
.imagePullPolicy("IfNotPresent")
368-
.image("busybox").addEnvItem(new V1EnvVar()
370+
.image(BUSYBOX_IMAGE + ":" + BUSYBOX_TAG).addEnvItem(new V1EnvVar()
369371
.name("DOMAIN_NAME")
370372
.value("xyz")));
371373
setPodAntiAffinity(domain);
@@ -374,9 +376,9 @@ private void createAndVerifyMiiDomain(String domainNamespace, String domainUid,
374376
domain.getSpec().getAdminServer().serverPod(new ServerPod()
375377
.addInitContainersItem(new V1Container()
376378
.addCommandItem("echo").addArgsItem("\"Hi from AdminServer\"")
377-
.name("busybox")
379+
.name("init-container")
378380
.imagePullPolicy("IfNotPresent")
379-
.image("busybox")));
381+
.image(BUSYBOX_IMAGE + ":" + BUSYBOX_TAG)));
380382
setPodAntiAffinity(domain);
381383
break;
382384
case "clusters":
@@ -390,19 +392,19 @@ private void createAndVerifyMiiDomain(String domainNamespace, String domainUid,
390392
mycluster.getServerPod()
391393
.addInitContainersItem(new V1Container()
392394
.addCommandItem("echo").addArgsItem("\"Hi from Cluster \"")
393-
.name("busybox")
395+
.name("init-container")
394396
.imagePullPolicy("IfNotPresent")
395-
.image("busybox"));
397+
.image(BUSYBOX_IMAGE + ":" + BUSYBOX_TAG));
396398
break;
397399
case "managedServers":
398400
domain.getSpec().addManagedServersItem(new ManagedServer()
399401
.serverName("managed-server1")
400402
.serverPod(new ServerPod()
401403
.addInitContainersItem(new V1Container()
402404
.addCommandItem("echo").addArgsItem("\"Hi from managed-server1\"")
403-
.name("busybox")
405+
.name("init-container")
404406
.imagePullPolicy("IfNotPresent")
405-
.image("busybox"))));
407+
.image(BUSYBOX_IMAGE + ":" + BUSYBOX_TAG))));
406408
setPodAntiAffinity(domain);
407409
break;
408410
default:

integration-tests/src/test/java/oracle/weblogic/kubernetes/TestConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ public interface TestConstants {
218218
public static final String MII_AUXILIARY_IMAGE_NAME = DOMAIN_IMAGES_REPO + "mii-ai-image";
219219
public static final String SKIP_BUILD_IMAGES_IF_EXISTS =
220220
Optional.ofNullable(System.getenv("SKIP_BUILD_IMAGES_IF_EXISTS")).orElse("false");
221+
public static final String BUSYBOX_IMAGE = "phx.ocir.io/weblogick8s/test-images/docker/busybox";
222+
public static final String BUSYBOX_TAG = "1.34.1";
221223

222224
// Skip the mii/wdt basic image build locally if needed
223225
public static final String MII_BASIC_IMAGE_TAG =

integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/LoggingExporter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
import static java.util.concurrent.TimeUnit.MINUTES;
4141
import static java.util.concurrent.TimeUnit.SECONDS;
42+
import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_IMAGE;
43+
import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_TAG;
4244
import static oracle.weblogic.kubernetes.TestConstants.COPY_WLS_LOGGING_EXPORTER_FILE_NAME;
4345
import static oracle.weblogic.kubernetes.TestConstants.ELASTICSEARCH_HTTP_PORT;
4446
import static oracle.weblogic.kubernetes.TestConstants.KIBANA_INDEX_KEY;
@@ -388,7 +390,7 @@ private static V1Deployment createElasticsearchDeploymentCr(LoggingExporterParam
388390
.spec(new V1PodSpec()
389391
.initContainers(Arrays.asList(new V1Container()
390392
.name("set-vm-max-map-count")
391-
.image("busybox")
393+
.image(BUSYBOX_IMAGE + ":" + BUSYBOX_TAG)
392394
.imagePullPolicy("IfNotPresent")
393395
.command(Arrays.asList("sysctl", "-w", "vm.max_map_count=262144"))
394396
.securityContext(new V1SecurityContext().privileged(true))))

integration-tests/src/test/resources/auxiliaryimage/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Default '/auxiliary'.
1717
#
1818

19-
FROM busybox
19+
FROM phx.ocir.io/weblogick8s/test-images/docker/busybox:1.34.1
2020
ARG AUXILIARY_IMAGE_PATH=/auxiliary
2121
ARG USER=oracle
2222
ARG USERID=1000

integration-tests/src/test/resources/auxiliaryimage/negative/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Default '/auxiliary'.
1717
#
1818

19-
FROM busybox
19+
FROM phx.ocir.io/weblogick8s/test-images/docker/busybox:1.34.1
2020
ARG AUXILIARY_IMAGE_PATH=/auxiliary
2121
ARG USER=tester
2222
ARG USERID=1001

jenkinsScript.sh

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,37 +98,19 @@ which mvn
9898
mvn --version
9999

100100
echo 'Info: Set up helm...'
101-
curl --ipv4 -LO --retry 3 https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz
102-
tar -xf helm-v${HELM_VERSION}-linux-amd64.tar.gz
101+
curl -Lo "helm.tar.gz" "https://objectstorage.us-phoenix-1.oraclecloud.com/n/weblogick8s/b/wko-system-test-files/o/helm%2Fhelm-v${HELM_VERSION}.tar.gz"
102+
tar zxf helm.tar.gz
103103
cp linux-amd64/helm ${WORKSPACE}/bin/helm
104104
helm version
105105

106106
echo 'Info: Set up kubectl...'
107-
set +e
108-
echo 'Info: download from object storage'
109-
curl --ipv4 -LO --retry 3 https://objectstorage.eu-frankfurt-1.oraclecloud.com/n/weblogicondocker/b/bucket-wko-jenkins/o/v${KUBECTL_VERSION}_kubectl
110-
mv v${KUBECTL_VERSION}_kubectl bin/kubectl
111-
chmod +x bin/kubectl
112-
out=$(kubectl version --client=true)
113-
res=$?
114-
if [ $res -ne 0 ]; then
115-
for i in 1 2 3 ; do
116-
curl --ipv4 -LO --retry 3 https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
117-
mv kubectl bin/kubectl
118-
chmod +x bin/kubectl
119-
out=$(kubectl version --client=true)
120-
res=$?
121-
[ $res -eq 0 ] && break
122-
sleep 10
123-
done
124-
fi
125-
set -e
107+
curl -Lo "${WORKSPACE}/bin/kubectl" "https://objectstorage.us-phoenix-1.oraclecloud.com/n/weblogick8s/b/wko-system-test-files/o/kubectl%2Fkubectl-v${KUBECTL_VERSION}"
108+
chmod +x ${WORKSPACE}/bin/kubectl
126109
kubectl version --client=true
127110

128111
echo 'Info: Set up kind...'
129-
curl --ipv4 -Lo ./kind --retry 3 https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-$(uname)-amd64
130-
chmod +x ./kind
131-
mv ./kind bin/kind
112+
curl -Lo "${WORKSPACE}/bin/kind" "https://objectstorage.us-phoenix-1.oraclecloud.com/n/weblogick8s/b/wko-system-test-files/o/kind%2Fkind-v${KIND_VERSION}"
113+
chmod +x "${WORKSPACE}/bin/kind"
132114
kind version
133115

134116
export TWO_CLUSTERS=false

kindtest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ if [ "${running}" = 'true' ]; then
210210
fi
211211
docker run \
212212
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
213-
registry:2
213+
phx.ocir.io/weblogick8s/test-images/docker/registry:2
214214

215215
reg_host="${reg_name}"
216216
if [ "${kind_network}" = "bridge" ]; then

0 commit comments

Comments
 (0)