Skip to content

Commit c54027e

Browse files
authored
chore(e2e): update to Crunchy PostgreSQL 17 & re-enable showcase-runtime tests (#3830)
* chore(ci): update to Crunchy PostgreSQL 17 * Unskip runtime tests * check for errors
1 parent c9f2a42 commit c54027e

File tree

6 files changed

+112
-10
lines changed

6 files changed

+112
-10
lines changed

.ibm/pipelines/resources/postgres-db/postgres.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ kind: PostgresCluster
33
metadata:
44
name: postgress-external-db
55
spec:
6-
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.3-1
7-
postgresVersion: 16
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi9-17.7-2547
7+
postgresVersion: 17
88
instances:
99
- name: instance1
1010
dataVolumeClaimSpec:
@@ -27,7 +27,7 @@ spec:
2727
cpu: 200m
2828
backups:
2929
pgbackrest:
30-
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.51-1
30+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi9-2.56.0-2547
3131
global:
3232
# Save backups for 7 days, this means 1 full backups with 6 differential ones in between
3333
repo1-retention-full: "1"

.ibm/pipelines/value_files/values_showcase-rbac.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ orchestrator:
469469
externalDBPort: "5432"
470470

471471
# -- Image for the init container used by the create-db job
472-
initContainerImage: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.3-1"
472+
initContainerImage: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi9-17.7-2547"
473473

474474
# -- Image for the container used by the create-db job
475-
createDBJobImage: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.3-1"
475+
createDBJobImage: "registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi9-17.7-2547"

e2e-tests/playwright/e2e/configuration-test/config-map.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
22
import { KubeClient } from "../../utils/kube-client";
33
import { Common } from "../../utils/common";
44
import { UIhelper } from "../../utils/ui-helper";
5-
test.describe.skip("Change app-config at e2e test runtime", () => {
5+
test.describe("Change app-config at e2e test runtime", () => {
66
test.beforeAll(async () => {
77
test.info().annotations.push(
88
{

e2e-tests/playwright/e2e/external-database/verify-tls-config-with-external-azure-db.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ interface AzureDbConfig {
1313
host: string | undefined;
1414
}
1515

16-
test.describe
17-
.skip("Verify TLS configuration with Azure Database for PostgreSQL health check", () => {
16+
test.describe("Verify TLS configuration with Azure Database for PostgreSQL health check", () => {
1817
const namespace = process.env.NAME_SPACE_RUNTIME || "showcase-runtime";
1918
const job: string = process.env.JOB_NAME || "";
2019
let deploymentName = process.env.RELEASE_NAME + "-developer-hub";

e2e-tests/playwright/e2e/external-database/verify-tls-config-with-external-rds.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ interface RdsConfig {
1313
host: string | undefined;
1414
}
1515

16-
test.describe
17-
.skip("Verify TLS configuration with RDS PostgreSQL health check", () => {
16+
test.describe("Verify TLS configuration with RDS PostgreSQL health check", () => {
1817
const namespace = process.env.NAME_SPACE_RUNTIME || "showcase-runtime";
1918
const job: string = process.env.JOB_NAME || "";
2019
let deploymentName = process.env.RELEASE_NAME + "-developer-hub";

e2e-tests/playwright/utils/kube-client.ts

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,87 @@ export class KubeClient {
465465
}
466466
}
467467

468+
/**
469+
* Check if pods are in a failure state (CrashLoopBackOff, ImagePullBackOff, etc.)
470+
* Returns a failure reason if found, null otherwise
471+
*/
472+
async checkPodFailureStates(
473+
namespace: string,
474+
labelSelector: string,
475+
): Promise<string | null> {
476+
try {
477+
const response = await this.coreV1Api.listNamespacedPod(
478+
namespace,
479+
undefined,
480+
undefined,
481+
undefined,
482+
undefined,
483+
labelSelector,
484+
);
485+
486+
const pods = response.body.items;
487+
if (pods.length === 0) {
488+
return null; // No pods yet, not a failure
489+
}
490+
491+
for (const pod of pods) {
492+
const podName = pod.metadata?.name || "unknown";
493+
const phase = pod.status?.phase;
494+
495+
// Check for Failed phase
496+
if (phase === "Failed") {
497+
const reason = pod.status?.reason || "Unknown";
498+
const message = pod.status?.message || "";
499+
return `Pod ${podName} is in Failed phase: ${reason} - ${message}`;
500+
}
501+
502+
// Check container statuses for failure states
503+
const containerStatuses = [
504+
...(pod.status?.containerStatuses || []),
505+
...(pod.status?.initContainerStatuses || []),
506+
];
507+
508+
for (const containerStatus of containerStatuses) {
509+
const containerName = containerStatus.name;
510+
const waiting = containerStatus.state?.waiting;
511+
512+
if (waiting) {
513+
const reason = waiting.reason || "";
514+
// Check for common failure states
515+
const failureStates = [
516+
"CrashLoopBackOff",
517+
"ImagePullBackOff",
518+
"ErrImagePull",
519+
"InvalidImageName",
520+
"CreateContainerConfigError",
521+
"CreateContainerError",
522+
];
523+
524+
if (failureStates.includes(reason)) {
525+
const message = waiting.message || "";
526+
return `Pod ${podName} container ${containerName} is in ${reason} state: ${message}`;
527+
}
528+
}
529+
530+
// Check for containers that have terminated with errors
531+
const terminated = containerStatus.state?.terminated;
532+
if (terminated && terminated.exitCode !== 0) {
533+
const reason = terminated.reason || "Error";
534+
const message = terminated.message || "";
535+
console.warn(
536+
`Pod ${podName} container ${containerName} terminated with exit code ${terminated.exitCode}: ${reason} - ${message}`,
537+
);
538+
}
539+
}
540+
}
541+
542+
return null; // No failure states detected
543+
} catch (error) {
544+
console.error(`Error checking pod failure states: ${error}`);
545+
return null; // Don't fail the check if we can't retrieve pod info
546+
}
547+
}
548+
468549
async waitForDeploymentReady(
469550
deploymentName: string,
470551
namespace: string,
@@ -492,6 +573,23 @@ export class KubeClient {
492573
JSON.stringify(conditions, null, 2),
493574
);
494575

576+
// Check for pod failure states when expecting replicas > 0
577+
if (expectedReplicas > 0) {
578+
const podFailureReason = await this.checkPodFailureStates(
579+
namespace,
580+
labelSelector,
581+
);
582+
if (podFailureReason) {
583+
console.error(
584+
`Pod failure detected: ${podFailureReason}. Logging events and pod logs...`,
585+
);
586+
await this.logDeploymentEvents(deploymentName, namespace);
587+
throw new Error(
588+
`Deployment ${deploymentName} failed to start: ${podFailureReason}`,
589+
);
590+
}
591+
}
592+
495593
// Log pod conditions using label selector
496594
await this.logPodConditions(namespace, labelSelector);
497595

@@ -508,11 +606,17 @@ export class KubeClient {
508606
);
509607
} catch (error) {
510608
console.error(`Error checking deployment status: ${error}`);
609+
// If we threw an error about pod failure, re-throw it
610+
if (error.message?.includes("failed to start")) {
611+
throw error;
612+
}
511613
}
512614

513615
await new Promise((resolve) => setTimeout(resolve, checkInterval));
514616
}
515617

618+
// On timeout, collect final diagnostics
619+
await this.logDeploymentEvents(deploymentName, namespace);
516620
throw new Error(
517621
`Deployment ${deploymentName} did not become ready in time (timeout: ${timeout / 1000}s).`,
518622
);

0 commit comments

Comments
 (0)