Skip to content

Harden container CI and improve BATS coverage for 8.0.1/binary/flex#555

Merged
kojiromike merged 9 commits intoopenemr:masterfrom
Jmevorach:master
Feb 20, 2026
Merged

Harden container CI and improve BATS coverage for 8.0.1/binary/flex#555
kojiromike merged 9 commits intoopenemr:masterfrom
Jmevorach:master

Conversation

@Jmevorach
Copy link
Copy Markdown
Contributor

@Jmevorach Jmevorach commented Feb 8, 2026

This PR improves reliability in both CI and runtime behavior for Docker variants (8.0.1, binary, flex), and makes BATS tests more meaningful by focusing on behavior instead of permissive output matching.

What this changes

  1. BATS coverage
  • Expands functional BATS coverage across 8.0.1, binary, and flex for startup/config scripts.
  1. CI / container test stability
  • Fixes container benchmarking log setup by creating test_results/ before tee writes output.
  • Runs full container functionality coverage by default; still supports targeted single-test runs via workflow_dispatch.
  • Removes fixed host port assumptions from swarm-mode tests to avoid CI conflicts (address already in use).
  1. Flex runtime robustness (Redis optionality)
  • Makes Redis session configuration conditional on Redis availability.
  • Calls wait_for_redis before Redis session setup; if Redis is unavailable, falls back to file sessions instead of failing startup.
  • Increases Redis wait tolerance for DNS/startup delays.
  • Documents intentional control-flow pattern (if ! wait_for_redis) for shellcheck clarity.
  1. CI docker startup correctness
  • Ensures test-actions-core starts only intended services (mysql + selected OpenEMR service) during docker compose up, avoiding unintended service startup in production test paths.

Why this matters

  • Prevents avoidable CI failures/flakes (ports, missing dirs, service over-start).
  • Improves confidence in script behavior validation.
  • Allows flex containers to remain healthy when Redis is temporarily unavailable.

…nd container-test issues; and makes the flex image more robust when Redis is unavailable.

## BATS tests
- **Flex:** Add functional tests for devtoolsLibrary, ssl, unlock_admin, and xdebug (validation/exit behavior).
- **8.0.1:** Add functional tests for setGlobalSettings (OPENEMR_SETTING_*), kcov-wrapper, and openemr.sh startup; relax kcov/ssl assertions for non-container runs.
- **All variants:** Focus on script behavior (run/source and assert outcomes), not only existence/syntax.

## Container benchmarking / CI
- Create `test_results/` before writing logs so `tee` does not fail with "No such file or directory".
- Run the **full** container functionality suite by default (all 9 tests per variant); use workflow_dispatch to run a single test if needed.
- Remove fixed host ports (8083, 8084) from the swarm_mode test to avoid "address already in use" in CI.

## Flex container
- Configure PHP Redis sessions **only when Redis is reachable**: call `wait_for_redis` first; if it fails, skip Redis config and use file sessions so the container can still become healthy.
- Increase Redis wait retries to 30 to allow for DNS/startup delay.
- Add ShellCheck disable for the intentional `if ! wait_for_redis` pattern.

## Testing
- BATS: 204 tests across 8.0.1, binary, and flex (all passing).
- Container functionality: full suite runs for 8.0.1, binary, and flex; flex Redis test and non-Redis tests no longer hang on Redis connection errors.
@Jmevorach Jmevorach changed the title Expands BATS coverage for 8.0.1, binary, and flex; fixes several CI a… Harden container CI and improve BATS coverage for 8.0.1/binary/flex Feb 16, 2026
Comment thread docker/openemr/flex/openemr.sh Outdated
Comment thread docker/openemr/flex/openemr.sh
@Jmevorach Jmevorach changed the title Harden container CI and improve BATS coverage for 8.0.1/binary/flex WIP: Harden container CI and improve BATS coverage for 8.0.1/binary/flex Feb 18, 2026
@Jmevorach Jmevorach changed the title WIP: Harden container CI and improve BATS coverage for 8.0.1/binary/flex Harden container CI and improve BATS coverage for 8.0.1/binary/flex Feb 18, 2026
@kojiromike kojiromike merged commit 2d65c08 into openemr:master Feb 20, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants