Skip to content

ci: add healthcheck for oracle - #12591

Merged
Cprakhar merged 1 commit into
typeorm:masterfrom
Cprakhar:ci/oracle
Jun 19, 2026
Merged

Cprakhar merged 1 commit into
typeorm:masterfrom
Cprakhar:ci/oracle

Conversation

@Cprakhar

Copy link
Copy Markdown
Collaborator

Description of change

Added a health check for Oracle. Sometimes tests fail because the user typeorm is not ready via the init sql scripts. See docker/oracle/01_init.sql.
Removed sleep from tests-linux.yml as now the run: docker compose up oracle --no-recreate --wait will wait until it's healthy.

Failing action: https://github.com/typeorm/typeorm/actions/runs/27741791548/job/82070618050?pr=12589

Logs from docker inspect typeorm-oracle:

"Health": {
                "Status": "healthy",
                "FailingStreak": 0,
                "Log": [
                    {
                        "Start": "2026-06-19T00:58:02.663102654+05:30",
                        "End": "2026-06-19T00:58:02.714371443+05:30",
                        "ExitCode": 1,
                        "Output": "\nSQL*Plus: Release 23.0.0.0.0 - Production on Thu Jun 18 19:28:02 2026\nVersion 23.7.0.25.01\n\nCopyright (c) 1982, 2025, Oracle.  All rights reserved.\n\nERROR:\nORA-12514: Cannot connect to database. Service FREEPDB1 is not registered with\nthe listener at host 127.0.0.1 port 1521.\n(CONNECTION_ID=VI0suH7sAFDgYwIAEqwTqQ==)\nHelp: https://docs.oracle.com/error-help/db/ora-12514/\n\n\nSP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus\nHelp: https://docs.oracle.com/error-help/db/sp2-0751/\n"
                    },
                    {
                        "Start": "2026-06-19T00:58:07.715341965+05:30",
                        "End": "2026-06-19T00:58:07.775540178+05:30",
                        "ExitCode": 1,
                        "Output": "\nSQL*Plus: Release 23.0.0.0.0 - Production on Thu Jun 18 19:28:07 2026\nVersion 23.7.0.25.01\n\nCopyright (c) 1982, 2025, Oracle.  All rights reserved.\n\nERROR:\nORA-12514: Cannot connect to database. Service FREEPDB1 is not registered with\nthe listener at host 127.0.0.1 port 1521.\n(CONNECTION_ID=VI0tBaSYANjgYwIAEqxpgw==)\nHelp: https://docs.oracle.com/error-help/db/ora-12514/\n\n\nSP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus\nHelp: https://docs.oracle.com/error-help/db/sp2-0751/\n"
                    },
                    {
                        "Start": "2026-06-19T00:58:12.77704615+05:30",
                        "End": "2026-06-19T00:58:12.841586331+05:30",
                        "ExitCode": 1,
                        "Output": "\nSQL*Plus: Release 23.0.0.0.0 - Production on Thu Jun 18 19:28:12 2026\nVersion 23.7.0.25.01\n\nCopyright (c) 1982, 2025, Oracle.  All rights reserved.\n\nERROR:\nORA-28547: connection to server failed, probable Oracle Net admin error\nHelp: https://docs.oracle.com/error-help/db/ora-28547/\n\n\nSP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus\nHelp: https://docs.oracle.com/error-help/db/sp2-0751/\n"
                    },
                    {
                        "Start": "2026-06-19T00:58:17.843153724+05:30",
                        "End": "2026-06-19T00:58:19.093941587+05:30",
                        "ExitCode": 1,
                        "Output": "\nSQL*Plus: Release 23.0.0.0.0 - Production on Thu Jun 18 19:28:17 2026\nVersion 23.7.0.25.01\n\nCopyright (c) 1982, 2025, Oracle.  All rights reserved.\n\nERROR:\nORA-01017: invalid credential or not authorized; logon denied\nHelp: https://docs.oracle.com/error-help/db/ora-01017/\n\n\nSP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus\nHelp: https://docs.oracle.com/error-help/db/sp2-0751/\n"
                    },
                    {
                        "Start": "2026-06-19T00:58:24.094787526+05:30",
                        "End": "2026-06-19T00:58:24.18767444+05:30",
                        "ExitCode": 0,
                        "Output": "\nSQL*Plus: Release 23.0.0.0.0 - Production on Thu Jun 18 19:28:24 2026\nVersion 23.7.0.25.01\n\nCopyright (c) 1982, 2025, Oracle.  All rights reserved.\n\n\nConnected to:\nOracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free\nVersion 23.7.0.25.01\n\nSQL> Disconnected from Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free\nVersion 23.7.0.25.01\n"
                    }
                ]
            }
  • Code is up-to-date with the master branch
  • This pull request links a relevant issue using a closing keyword:
    Fixes #NNNN, Closes #NNNN, or Resolves #NNNN
  • There are new or updated tests validating the change (tests/**.test.ts)
  • Documentation has been updated to reflect this change (docs/docs/**.md)

@github-actions github-actions Bot added the needs-triage PR needs issue link triage label Jun 18, 2026
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Oracle healthcheck too strict 🐞 Bug ☼ Reliability
Description
docker-compose.yml marks Oracle unhealthy after only 5 checks (10s interval, 5s timeout), and the
CI job gates test execution on docker compose ... --wait; if Oracle takes longer to accept
sqlplus connections, this can fail the workflow even though the DB would become ready shortly
after. This is especially relevant now that the explicit post-startup sleep was removed and
readiness depends entirely on health status.
Code

docker-compose.yml[R109-117]

+    healthcheck:
+      test:
+        [
+          "CMD-SHELL",
+          "echo 'EXIT' | sqlplus -L typeorm/oracle@localhost:1521/FREEPDB1",
+        ]
+      interval: 10s
+      timeout: 5s
+      retries: 5
Evidence
The workflow explicitly waits on Oracle health before running tests, and the new healthcheck
configuration can mark the service unhealthy after a relatively short failure window compared to
typical Oracle startup/auth readiness time; this can cause intermittent CI failures now that there
is no additional sleep buffer.

docker-compose.yml[100-121]
.github/workflows/tests-linux.yml[197-216]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Oracle healthcheck currently uses `interval: 10s`, `timeout: 5s`, `retries: 5`, which can mark the container `unhealthy` during normal/slow Oracle startup. Since CI uses `docker compose up oracle --no-recreate --wait`, an `unhealthy` state can cause the step to fail before the DB becomes ready.

## Issue Context
CI previously had an extra `sleep 3`; after this PR it relies on the container healthcheck to gate readiness.

## Fix Focus Areas
- docker-compose.yml[100-121]
- .github/workflows/tests-linux.yml[197-216]

## Suggested change
Adjust the Oracle healthcheck to be more tolerant, e.g.:
- add a `start_period: 60s` (or longer) so initial failures don't count
- and/or increase `retries` (e.g. 12–30) and/or `timeout` (e.g. 10s)
This keeps the readiness gate but reduces flakiness when Oracle startup is slower.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

Qodo Logo

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪 LGTM

@Cprakhar
Cprakhar merged commit 3b774f1 into typeorm:master Jun 19, 2026
44 of 45 checks passed
@github-actions github-actions Bot added this to the 1.0 milestone Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-triage PR needs issue link triage

Development

Successfully merging this pull request may close these issues.

3 participants