Skip to content

feat: support custom OLR image in tests + fix Unicode handling#25

Merged
rophy merged 4 commits into
masterfrom
feat/olr-image-override
May 23, 2026
Merged

feat: support custom OLR image in tests + fix Unicode handling#25
rophy merged 4 commits into
masterfrom
feat/olr-image-override

Conversation

@rophy
Copy link
Copy Markdown
Owner

@rophy rophy commented May 23, 2026

Summary

  • Allow overriding OLR image via OLR_IMAGE env var in all docker-compose files (enables testing release images like ghcr.io/rophy/openlogreplicator:v1.9.0.1)
  • Add --user to docker run in redo log tests for release image compatibility (release image runs as UID 1001)
  • Add user: override in compose services, exported from base driver
  • Fix NLS_LANG=AMERICAN_AMERICA.AL32UTF8 in docker exec calls — enterprise-19 defaulted to US7ASCII, corrupting Unicode in LogMiner output

Test plan

  • Redo log tests: 161/161 passed (release image)
  • SQL e2e free-23: 36 passed, 20 skipped (release image)
  • SQL e2e xe-21: 36 passed, 20 skipped (release image)
  • SQL e2e enterprise-19: 36 passed, 20 skipped (release image, nchar-nclob now passes)

Summary by CodeRabbit

  • Chores
    • Enhanced Docker container configurations to support environment-variable-driven customization for container images and runtime user/group settings across test environments.
    • Updated test execution scripts to explicitly configure database locale settings and export user/group identifiers for consistent container execution behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

📝 Walkthrough

Walkthrough

This PR parameterizes Docker container execution across multiple test environments. Docker Compose files use OLR_IMAGE, OLR_UID, and OLR_GID environment variables for flexible image and user configuration. Supporting scripts export these values, test fixtures apply them, and Docker exec operations ensure Oracle locale consistency.

Changes

Container user and environment parameterization

Layer / File(s) Summary
Docker Compose image and user parameterization
tests/dbz-twin/docker-compose.yaml, tests/environments/enterprise-19/docker-compose.yaml, tests/environments/free-23/docker-compose.yaml, tests/environments/xe-21-official/docker-compose.yaml, tests/environments/xe-21/docker-compose.yaml
All five docker-compose.yaml files update the olr service to derive container image from ${OLR_IMAGE:-olr-dev:latest} and runtime user/group from ${OLR_UID:-1000}:${OLR_GID:-1000}, replacing the previous OLR_IMAGE_TAG-based image construction.
Shell script environment exports
tests/sql/scripts/drivers/base.sh
base.sh exports OLR_UID and OLR_GID derived from the current process user and group IDs, making these values available to Docker Compose files.
Test fixture user configuration
tests/fixtures/test_fixtures.py
_run_olr passes --user with host UID/GID (os.getuid():os.getgid()) when executing the Docker container, ensuring the container runs with consistent user identity.
Docker exec locale configuration
tests/sql/scripts/drivers/docker.sh
_DEXEC now consistently sets NLS_LANG=AMERICAN_AMERICA.AL32UTF8 for all Oracle sqlplus executions, whether or not DOCKER_EXEC_USER is specified.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 Docker users now dance,
With UID and GID in place,
Containers feel at home—
NLS_LANG ensures the locale,
All test worlds now align! 🌍✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main changes: supporting custom OLR images via environment variables and fixing Unicode handling with NLS_LANG. Both aspects are core to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/olr-image-override

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/dbz-twin/docker-compose.yaml (1)

45-45: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Hardcoded tmpfs UID conflicts with configurable OLR_UID.

The tmpfs mount specifies uid=1000, but the service now runs as ${OLR_UID:-1000}. When a custom OLR_UID is set (e.g., for release images running as UID 1001), the container process won't have write permissions to /olr-data.

Docker Compose doesn't support variable substitution in tmpfs options. Consider one of these approaches:

  • Document that OLR_UID must remain 1000 for the dbz-twin environment
  • Use a named volume instead of tmpfs
  • Add an init script to chown the tmpfs mount at container startup
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/dbz-twin/docker-compose.yaml` at line 45, The tmpfs mount in
tests/dbz-twin/docker-compose.yaml hardcodes uid=1000 which conflicts with the
configurable OLR_UID; update the compose setup to avoid this mismatch by either
switching the tmpfs to a named volume (replace the tmpfs entry with a named
volume mount) or add an init step inside the container startup (e.g., an
entrypoint/init script referenced by the service) that chowns /olr-data to
${OLR_UID:-1000} at runtime; ensure references to OLR_UID remain consistent and
document the chosen approach in the compose/service comments so the service
(which currently expects ${OLR_UID:-1000}) can write to /olr-data.
🧹 Nitpick comments (1)
tests/sql/scripts/drivers/base.sh (1)

37-38: 💤 Low value

Shellcheck warns about potentially masking command failures.

Combining declaration and assignment masks the exit status of id -u and id -g. While these commands rarely fail, splitting the operations would be more robust.

♻️ Proposed fix to satisfy shellcheck
 # Export UID/GID so docker-compose can set user: on the olr service
-export OLR_UID="$(id -u)"
-export OLR_GID="$(id -g)"
+OLR_UID="$(id -u)"
+OLR_GID="$(id -g)"
+export OLR_UID OLR_GID
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/sql/scripts/drivers/base.sh` around lines 37 - 38, The assignments to
OLR_UID and OLR_GID mask failures of id -u / id -g; change to run id -u and id
-g separately, check their exit status, and only export OLR_UID and OLR_GID
after confirming the commands succeeded (e.g., capture each output into a temp
variable, verify $? is zero, then export OLR_UID and OLR_GID). Update the script
locations where OLR_UID and OLR_GID are set (the lines exporting OLR_UID and
OLR_GID in base.sh) to follow this safer pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tests/dbz-twin/docker-compose.yaml`:
- Line 45: The tmpfs mount in tests/dbz-twin/docker-compose.yaml hardcodes
uid=1000 which conflicts with the configurable OLR_UID; update the compose setup
to avoid this mismatch by either switching the tmpfs to a named volume (replace
the tmpfs entry with a named volume mount) or add an init step inside the
container startup (e.g., an entrypoint/init script referenced by the service)
that chowns /olr-data to ${OLR_UID:-1000} at runtime; ensure references to
OLR_UID remain consistent and document the chosen approach in the
compose/service comments so the service (which currently expects
${OLR_UID:-1000}) can write to /olr-data.

---

Nitpick comments:
In `@tests/sql/scripts/drivers/base.sh`:
- Around line 37-38: The assignments to OLR_UID and OLR_GID mask failures of id
-u / id -g; change to run id -u and id -g separately, check their exit status,
and only export OLR_UID and OLR_GID after confirming the commands succeeded
(e.g., capture each output into a temp variable, verify $? is zero, then export
OLR_UID and OLR_GID). Update the script locations where OLR_UID and OLR_GID are
set (the lines exporting OLR_UID and OLR_GID in base.sh) to follow this safer
pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ccdce2b5-761d-46e3-86f1-76625d9e487e

📥 Commits

Reviewing files that changed from the base of the PR and between 0c23e8c and 235a00d.

📒 Files selected for processing (8)
  • tests/dbz-twin/docker-compose.yaml
  • tests/environments/enterprise-19/docker-compose.yaml
  • tests/environments/free-23/docker-compose.yaml
  • tests/environments/xe-21-official/docker-compose.yaml
  • tests/environments/xe-21/docker-compose.yaml
  • tests/fixtures/test_fixtures.py
  • tests/sql/scripts/drivers/base.sh
  • tests/sql/scripts/drivers/docker.sh

@rophy rophy merged commit 26641b0 into master May 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant