Skip to content

Upgraded the BATS tests to 'bats-helpers' 2.0. - #2894

Merged
AlexSkrypnyk merged 8 commits into
mainfrom
feature/bats-helpers-dev
Aug 5, 2026
Merged

Upgraded the BATS tests to 'bats-helpers' 2.0.#2894
AlexSkrypnyk merged 8 commits into
mainfrom
feature/bats-helpers-dev

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

This upgrades the BATS suite in .vortex/tooling/tests/ from bats-helpers 1.6.0 to 2.0.0 and migrates every call site off the functions and variables that release deprecates. It touches 25 files, renaming 290 deprecated call sites, moving three environment variables onto the BATS_HELPERS_ prefix, and correcting four container registry tests whose mocking assumptions turned out to be wrong under the stricter defaults 2.0 introduces. The full suite passes 309/309 with zero deprecation notices, matching a 1.6.0 baseline also run at 309/309.

The suite was tracked against the unreleased development branch throughout 2.0's stabilisation, which is where the upstream fixes listed below came from. It now pins the published release.

Changes

  • Moved .vortex/tooling/package.json from npm:@drevops/bats-helpers@^1.5.1 to npm:@drevops/bats-helpers@^2.0 and migrated 290 deprecated call sites across 25 files: run_steps to steps_run (277 sites), assert_contains to assert_string_contains (7 sites) and assert_not_contains to assert_string_not_contains (6 sites) - both of which also swap their arguments to haystack-first - setup_mock to mock_setup, and assert_not_git_repo to assert_git_not_repo.
  • Renamed three variables in _helper.bash onto the BATS_HELPERS_ prefix: ASSERT_DIR_EXCLUDE, RUN_STEPS_DEBUG, and BATS_FIXTURE_EXPORT_CODEBASE_ENABLED.
  • Adapted fetch-db-container-registry.bats to the new strict-mock default, in which a mock carrying indexed responses but no default response rejects any call its expectations do not cover.
  • Resolved yarn.lock to the published 2.0.0 tarball with its integrity hash.

Verification

  • Full BATS suite: 309/309 passing with zero deprecation notices.
  • The deprecation-notice detector was itself validated with a positive control before trusting a clean run.
  • ahoy lint-scripts passes.
  • A 1.6.0 baseline run also comes back at 309/309, giving a clean before/after comparison.

Findings

  • Four fetch-db-container-registry tests mocked the login script by path via mock_command "./.vortex/tooling/src/vortex-login-container-registry", but the script invokes it as "$(dirname "${BASH_SOURCE[0]}")/vortex-login-container-registry" - a direct path rather than a PATH lookup - so the mock never intercepted it. The real login script always ran, and its docker login landed as call 2 while the tests assumed call 2 was the pull. The dead mock lines are removed and the expectations now match the real inspect -> login -> pull sequence.
  • The test formerly named "Skip fetch when image already exists on host" does not actually skip: image_expanded_successfully only becomes 1 through the db.tar branch, so without an expanded archive the script logs in and pulls regardless of the image being present. Nothing in the test required the fetch path, so the misleading name went unnoticed. It is now named "Fetch image when it exists on host and no archive exists" and asserts the fetch it triggers. That records the current behaviour rather than endorsing it - vortex-fetch-db-container-registry is unchanged here, and whether it should short-circuit when the image is already on the host is tracked separately in Database image is pulled from the registry even when it already exists on the host #2896.
  • The test covering the default registry never checked that docker.io reached the pull, because the registry appears in the pull target and nowhere in the script output. It now asserts the recorded arguments of the pull call.
  • Two upstream issues came out of testing this version against the suite, and both were fixed before the branch settled: drevops/bats-helpers#178 moved the library's environment variables onto the BATS_HELPERS_ prefix, and drevops/bats-helpers#209 documented the mock behaviour changes that previously reached consumers with no notice and restored multi-line responses in command steps. The suite also surfaced a shared-state bug upstream fixed by anchoring the mock directory to the per-test sandbox, which had been making the suite fail non-deterministically at full-suite scale while every file passed in isolation.

Before / After

BEFORE
┌─────────────────────────────────────┐
│ .vortex/tooling/package.json        │
│                                     │
│ "bats-helpers":                     │
│   "npm:@drevops/bats-helpers@^1.5.1"│
└─────────────────────────────────────┘
                  │
                  ▼
AFTER
┌─────────────────────────────────────┐
│ .vortex/tooling/package.json        │
│                                     │
│ "bats-helpers":                     │
│   "npm:@drevops/bats-helpers@^2.0"  │
└─────────────────────────────────────┘

fetch-db-container-registry.bats -- "image already on host" test

BEFORE: asserted only 1 mock call (docker inspect), so the script
        logging in and pulling anyway went unchecked.

  docker inspect  (1, image found) ──▶ [assertions stop here]

AFTER: dead/misleading mock lines removed, all 3 real calls asserted.

  docker inspect  (1, image found)
        │
        ▼
  docker login    (2, real login still runs - fetch is not skipped)
        │
        ▼
  docker pull     (3, real pull still runs)

Summary by CodeRabbit

  • Tests

    • Updated the test suite for the latest helper-library APIs and configuration.
    • Improved container registry test coverage for login, image pulls, existing images, and default registry targets.
    • Refined string and path assertions while preserving existing scenarios and expected outcomes.
  • Chores

    • Upgraded the development testing helper dependency to version 2.0.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ff874335-547b-498e-9eb9-6331f7e82258

📥 Commits

Reviewing files that changed from the base of the PR and between 5a14578 and 6de1dd9.

⛔ Files ignored due to path filters (1)
  • .vortex/tooling/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (26)
  • .vortex/tooling/package.json
  • .vortex/tooling/tests/_helper.bash
  • .vortex/tooling/tests/unit/deploy-artifact.bats
  • .vortex/tooling/tests/unit/deploy-lagoon.bats
  • .vortex/tooling/tests/unit/fetch-db-acquia.bats
  • .vortex/tooling/tests/unit/fetch-db-container-registry.bats
  • .vortex/tooling/tests/unit/fetch-db-lagoon.bats
  • .vortex/tooling/tests/unit/fetch-db-s3.bats
  • .vortex/tooling/tests/unit/fetch-db-url.bats
  • .vortex/tooling/tests/unit/helpers.bats
  • .vortex/tooling/tests/unit/import-db-file.bats
  • .vortex/tooling/tests/unit/login-container-registry.bats
  • .vortex/tooling/tests/unit/notify-github.bats
  • .vortex/tooling/tests/unit/notify-jira.bats
  • .vortex/tooling/tests/unit/notify-newrelic.bats
  • .vortex/tooling/tests/unit/post-coverage-comment.bats
  • .vortex/tooling/tests/unit/provision-enable-demo-modules.bats
  • .vortex/tooling/tests/unit/provision-enable-dev-modules.bats
  • .vortex/tooling/tests/unit/provision-example.bats
  • .vortex/tooling/tests/unit/provision-migration.bats
  • .vortex/tooling/tests/unit/provision-search-index.bats
  • .vortex/tooling/tests/unit/provision.bats
  • .vortex/tooling/tests/unit/push-container-registry.bats
  • .vortex/tooling/tests/unit/push-db-s3.bats
  • .vortex/tooling/tests/unit/setup-ssh.bats
  • .vortex/tooling/tests/unit/update-vortex.bats

Walkthrough

The PR upgrades bats-helpers, renames shared helper APIs and variables, updates string assertions, and migrates unit tests to steps_run. Container-registry tests now model direct Docker login and pull calls.

Changes

Bats helpers migration

Layer / File(s) Summary
Helper contracts and dependency
.vortex/tooling/package.json, .vortex/tooling/tests/_helper.bash
The tooling uses bats-helpers version ^2.0, namespaced variables, renamed mock functions, and assert_git_not_repo.
Container-registry mock flow
.vortex/tooling/tests/unit/fetch-db-container-registry.bats
Mocks represent image inspection, registry login, and image pull calls. Existing host images are fetched when no expanded archive exists.
String assertion updates
.vortex/tooling/tests/unit/fetch-db-url.bats, .vortex/tooling/tests/unit/helpers.bats, .vortex/tooling/tests/unit/notify-newrelic.bats
Tests use assert_string_contains and assert_string_not_contains with the updated argument order.
Deployment and database tests
.vortex/tooling/tests/unit/deploy-*.bats, .vortex/tooling/tests/unit/fetch-db-*.bats, .vortex/tooling/tests/unit/import-db-file.bats
Mock setup and assertion execution use steps_run instead of run_steps.
Notification, provisioning, push, SSH, and update tests
.vortex/tooling/tests/unit/notify-*.bats, .vortex/tooling/tests/unit/post-coverage-comment.bats, .vortex/tooling/tests/unit/provision*.bats, .vortex/tooling/tests/unit/push-*.bats, .vortex/tooling/tests/unit/setup-ssh.bats, .vortex/tooling/tests/unit/update-vortex.bats
These tests use steps_run for mock setup and assertions. Test scenarios remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: A3

Poem

A rabbit updates helpers with care,
steps_run hops through tests everywhere.
Docker inspects, logs in, and pulls,
New assertions follow helper rules.
The Bats suite thumps its feet.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrating the BATS test suite to bats-helpers 2.0.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bats-helpers-dev

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

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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.

Inline comments:
In @.vortex/tooling/tests/unit/fetch-db-container-registry.bats:
- Around line 98-102: Update the existing-host test around the current “Skip
fetch” test name to reflect that fetching continues when no expanded archive
exists. Add an assertion requiring the `Fetching myorg/myapp image from the
registry.` message, while preserving the existing login and pull mock sequence.
- Around line 124-125: The fetch-db-container-registry test currently only stubs
Docker output and does not verify the actual registry/image arguments. Update
the unit test around the mock_docker setup to use STEPS with steps_run "setup"
and steps_run "assert", and assert the Docker call log includes the login target
docker.io and the pull command `@docker` pull docker.io/myorg/myapp. Keep the
existing test flow focused on the fetch-db-container-registry behavior while
replacing the fixed side effect with argument validation.

In @.vortex/tooling/tests/unit/provision.bats:
- Around line 206-211: Update the tooling dependency configuration in
package.json and yarn.lock so bats-helpers resolves to the published npm alias
npm:`@drevops/bats-helpers`@^2.0 rather than the GitHub main branch, keeping the
existing dependency usage unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5cf7455b-8a93-4d5f-9d45-21ecf6bda062

📥 Commits

Reviewing files that changed from the base of the PR and between 22deef4 and b03e044.

⛔ Files ignored due to path filters (1)
  • .vortex/tooling/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (26)
  • .vortex/tooling/package.json
  • .vortex/tooling/tests/_helper.bash
  • .vortex/tooling/tests/unit/deploy-artifact.bats
  • .vortex/tooling/tests/unit/deploy-lagoon.bats
  • .vortex/tooling/tests/unit/fetch-db-acquia.bats
  • .vortex/tooling/tests/unit/fetch-db-container-registry.bats
  • .vortex/tooling/tests/unit/fetch-db-lagoon.bats
  • .vortex/tooling/tests/unit/fetch-db-s3.bats
  • .vortex/tooling/tests/unit/fetch-db-url.bats
  • .vortex/tooling/tests/unit/helpers.bats
  • .vortex/tooling/tests/unit/import-db-file.bats
  • .vortex/tooling/tests/unit/login-container-registry.bats
  • .vortex/tooling/tests/unit/notify-github.bats
  • .vortex/tooling/tests/unit/notify-jira.bats
  • .vortex/tooling/tests/unit/notify-newrelic.bats
  • .vortex/tooling/tests/unit/post-coverage-comment.bats
  • .vortex/tooling/tests/unit/provision-enable-demo-modules.bats
  • .vortex/tooling/tests/unit/provision-enable-dev-modules.bats
  • .vortex/tooling/tests/unit/provision-example.bats
  • .vortex/tooling/tests/unit/provision-migration.bats
  • .vortex/tooling/tests/unit/provision-search-index.bats
  • .vortex/tooling/tests/unit/provision.bats
  • .vortex/tooling/tests/unit/push-container-registry.bats
  • .vortex/tooling/tests/unit/push-db-s3.bats
  • .vortex/tooling/tests/unit/setup-ssh.bats
  • .vortex/tooling/tests/unit/update-vortex.bats

Comment thread .vortex/tooling/tests/unit/fetch-db-container-registry.bats
Comment on lines +124 to +125
mock_set_side_effect "${mock_docker}" "echo 'logged in'" 2
mock_set_side_effect "${mock_docker}" "echo 'pulled from docker.io'" 3

@coderabbitai coderabbitai Bot Aug 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 5 'mock_(command|set_side_effect)|call|history|verify|assert' \
  .vortex/tooling/tests/_helper.bash

Repository: drevops/vortex

Length of output: 2981


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- target test ---'
sed -n '90,145p' .vortex/tooling/tests/unit/fetch-db-container-registry.bats

printf '%s\n' '--- helper mock references ---'
rg -n -C 4 'mock_(setup|command|set_side_effect)|mock_[a-z_]+|run_command|output|status|lines|history|call|invocation|docker' \
  .vortex/tooling/tests .vortex/tooling 2>/dev/null | head -n 300

printf '%s\n' '--- repository files related to mocking ---'
git ls-files | rg '(^|/)(mock|.*helper.*|.*bats.*)$|bats-helpers|fetch-db-container-registry'

Repository: drevops/vortex

Length of output: 30576


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- mock setup and helper loading ---'
sed -n '1,90p' .vortex/tooling/tests/_helper.bash
rg -n -C 8 'steps_run|mock_set_side_effect|mock_set_output|mock_command|mock_setup' \
  .vortex/tooling/tests

printf '%s\n' '--- invocation assertions ---'
rg -n -C 8 'STEPS=|steps_run|`@docker`|assert.*(output|line|contains)|mocks=' \
  .vortex/tooling/tests/unit | head -n 400

printf '%s\n' '--- target script ---'
sed -n '1,220p' .vortex/tooling/src/vortex-fetch-db-container-registry

Repository: drevops/vortex

Length of output: 50371


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- helper loading and step API ---'
sed -n '1,75p' .vortex/tooling/tests/_helper.bash
rg -n -C 12 'steps_run' .vortex/tooling/tests/unit/fetch-db-container-registry.bats
rg -n -C 8 'mock_command|mock_set_side_effect|steps_run' .vortex/tooling/tests/_helper.bash

printf '%s\n' '--- target script ---'
sed -n '1,220p' .vortex/tooling/src/vortex-fetch-db-container-registry

printf '%s\n' '--- relevant assertion examples ---'
sed -n '60,115p' .vortex/tooling/tests/unit/push-container-registry.bats
sed -n '1,65p' .vortex/tooling/tests/unit/fetch-db-s3.bats

Repository: drevops/vortex

Length of output: 3271


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- target script ---'
sed -n '1,220p' .vortex/tooling/src/vortex-fetch-db-container-registry

printf '%s\n' '--- target test and step assertions ---'
sed -n '1,180p' .vortex/tooling/tests/unit/fetch-db-container-registry.bats
rg -n -C 12 'steps_run|STEPS=|`@docker`|mock_command|mock_set_side_effect' \
  .vortex/tooling/tests/unit/fetch-db-container-registry.bats \
  .vortex/tooling/tests/unit/push-container-registry.bats \
  .vortex/tooling/tests/unit/fetch-db-s3.bats || true

printf '%s\n' '--- mock library source references ---'
find .vortex/tooling -type f -path '*bats-helpers*' -o -type f -iname '*mock*' 2>/dev/null | head -n 100
rg -n -C 8 'steps_run|mock_set_side_effect|mock_command' \
  .vortex/tooling/node_modules 2>/dev/null | head -n 200 || true

Repository: drevops/vortex

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- dependency and mock-library references ---'
rg -n -C 6 '"bats-helpers"|bats_helpers|bats-helpers' \
  .vortex/tooling/package.json .vortex/tooling/package-lock.json \
  .vortex/tooling/yarn.lock .vortex/tooling/pnpm-lock.yaml \
  .github .vortex 2>/dev/null | head -n 160 || true

printf '%s\n' '--- all fetch-db-container-registry step assertions ---'
rg -n -C 5 'STEPS=|steps_run|`@docker`' \
  .vortex/tooling/tests/unit/fetch-db-container-registry.bats || true

printf '%s\n' '--- login script command shape ---'
sed -n '1,180p' .vortex/tooling/src/vortex-login-container-registry

printf '%s\n' '--- repository documentation for steps_run ---'
rg -n -C 8 'steps_run|mock_set_side_effect|mock_command' \
  README.md .vortex/docs .vortex/tooling 2>/dev/null | head -n 240 || true

Repository: drevops/vortex

Length of output: 29946


🌐 Web query:

Find the steps_run, mock_command, and mock_set_side_effectimplementations indrevops/bats-helpersversion 1.6.0, including the expectedSTEPS syntax for asserting mocked command invocations.

💡 Result:

In drevops/bats-helpers version 1.6.0, the Step Runner is a tool used to process sequences of string and command assertions [1][2]. The steps_run function (referenced as the process for running steps) is used within the Step Runner to process assertions [1][3]. It typically works in conjunction with process_steps, which facilitates the setup phase of mocks and the subsequent assertion phase of testing [3]. The mocking functions are defined as follows: mock_command Arguments: command_name Description: Mocks the provided command and returns the path to the mock [1][2][3]. mock_set_side_effect Arguments: mock, code, [call_index] Description: Sets shell code (a side effect) to execute when the mock is called [1][2][3]. The side effect is executed in the context of the mock, runs after output generation but before the exit status is returned, and can be chained using; or && [1][3]. STEPS Syntax for Mocked Commands The expected syntax for asserting mocked command invocations within the Step Runner is: @ [ |*] # <mock_status> [ # <mock_output> [ # <mock_side_effect> ]] In this syntax: - <mock_status> is the required exit status. - <mock_output> is the optional output. - <mock_side_effect> is the optional Bash code to be executed when the mock is called [1][3]. The side effect is specifically useful for simulating complex behaviors, such as logging, setting environment variables, or creating files and directories during the test execution [1][2].

Citations:


🌐 Web query:

site:github.com/drevops/bats-helpers "steps_run \"setup\"" "mock_set_side_effect"

💡 Result:

The functions mentioned, including steps_run (specifically in the context of the process_steps wrapper), setup, and mock_set_side_effect, are part of the drevops/bats-helpers library, which is a collection of utilities for BATS (Bash Automated Testing System) [1]. In this framework, these components are used to mock command-line programs and verify their behavior during testing [1]. 1. setup: When using the Step Runner functionality, you typically initialize the mock environment by calling process_steps "setup" [1]. This phase creates the necessary mocks and prepares the testing environment [1]. 2. mock_set_side_effect: This function is used to define custom Bash code that should be executed whenever a specific mocked command is called [1]. - Syntax: mock_set_side_effect <mock> <code> [call_index] [1]. - Usage: It is highly effective for simulating complex command behaviors, such as creating files or directories, modifying environment variables, or logging activity [1]. - Execution: The provided code runs in the context of the mock, executing after the mock's output is generated but before it returns its exit status [1]. Multiple commands can be chained using standard shell operators like ; or && [1]. When defining steps for the Step Runner, the syntax for a mocked command assertion allows you to include the side effect directly in the step definition: @ [ |*] # <mock_status> [ # <mock_output> [ # <mock_side_effect> ]] [1].

Citations:


Assert the default registry and image in the Docker call log.

The fixed echo 'pulled from docker.io' side effect does not validate Docker arguments. Use STEPS with steps_run "setup" and steps_run "assert" to assert @docker pull docker.io/myorg/myapp (and the login target docker.io).

🤖 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 @.vortex/tooling/tests/unit/fetch-db-container-registry.bats around lines 124
- 125, The fetch-db-container-registry test currently only stubs Docker output
and does not verify the actual registry/image arguments. Update the unit test
around the mock_docker setup to use STEPS with steps_run "setup" and steps_run
"assert", and assert the Docker call log includes the login target docker.io and
the pull command `@docker` pull docker.io/myorg/myapp. Keep the existing test flow
focused on the fetch-db-container-registry behavior while replacing the fixed
side effect with argument validation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in f1735e9, though with a lighter change than suggested. The gap was real: the test is named for the default registry but nothing verified that docker.io actually reached the pull, since the registry never appears in the script output. It now asserts the recorded arguments directly with assert_string_contains on mock_get_call_args for call 3, checking 'pull docker.io/myorg/myapp'. That covers the substance without converting the test to STEPS - the rest of this file uses the mock_set_side_effect style, and a partial conversion would leave two idioms in one file for no extra coverage. The login target is not asserted because the login runs in vortex-login-container-registry, which this test does not exercise; login-container-registry.bats covers it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@AlexSkrypnyk, acknowledged. The direct mock_get_call_args assertion verifies the default-registry pull without introducing a second test idiom in this file.

The login-target assertion does not belong in this test. vortex-login-container-registry owns that Docker invocation, and login-container-registry.bats covers it.


✏️ Learnings added
Learnt from: AlexSkrypnyk
Repo: drevops/vortex PR: 2894
File: .vortex/tooling/tests/unit/fetch-db-container-registry.bats:124-125
Timestamp: 2026-08-05T08:25:32.115Z
Learning: In `.vortex/tooling/tests/unit/fetch-db-container-registry.bats`, default-registry coverage should assert the Docker pull arguments with `mock_get_call_args`; the fetch script invokes `vortex-login-container-registry` separately, so Docker login arguments belong in `.vortex/tooling/tests/unit/login-container-registry.bats`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

Comment thread .vortex/tooling/tests/unit/provision.bats
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.63%. Comparing base (5a14578) to head (6de1dd9).

Files with missing lines Patch % Lines
.vortex/tooling/tests/_helper.bash 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2894      +/-   ##
==========================================
- Coverage   87.05%   86.63%   -0.43%     
==========================================
  Files         101       94       -7     
  Lines        4820     4661     -159     
  Branches       47        3      -44     
==========================================
- Hits         4196     4038     -158     
+ Misses        624      623       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a73b7e673ac8b3c39a230ff--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
.vortex/tooling/tests/unit/fetch-db-container-registry.bats (1)

13-19: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add assertions to verify recorded Docker commands in each test scenario.

These tests configure side effects by call index but do not verify the actual commands. A missing login or pull operation can consume a different side effect and still return success.

  • Lines 13–19: Assert the login target and pull registry.example.com/myorg/myapp.
  • Lines 73–75: Assert pull registry.example.com/myorg/base.
  • Lines 98–102: Assert the login and pull calls for registry.example.com/myorg/myapp.
  • Line 114: Supplement the fetch-message assertion with the recorded pull assertion.
  • Lines 152–153: Assert the indexed pull target registry.example.com/myorg/migration-db.
🤖 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 @.vortex/tooling/tests/unit/fetch-db-container-registry.bats around lines 13
- 19, Verify the recorded Docker commands in each scenario so configured side
effects cannot mask missing operations. In
.vortex/tooling/tests/unit/fetch-db-container-registry.bats at lines 13-19,
assert the login target and pull of registry.example.com/myorg/myapp; at lines
73-75, assert the pull of registry.example.com/myorg/base; at lines 98-102,
assert the login and pull for registry.example.com/myorg/myapp; at line 114,
retain the fetch-message assertion and add the recorded pull assertion; and at
lines 152-153, assert the indexed pull target
registry.example.com/myorg/migration-db.
🤖 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 @.vortex/tooling/tests/unit/fetch-db-container-registry.bats:
- Around line 13-19: Verify the recorded Docker commands in each scenario so
configured side effects cannot mask missing operations. In
.vortex/tooling/tests/unit/fetch-db-container-registry.bats at lines 13-19,
assert the login target and pull of registry.example.com/myorg/myapp; at lines
73-75, assert the pull of registry.example.com/myorg/base; at lines 98-102,
assert the login and pull for registry.example.com/myorg/myapp; at line 114,
retain the fetch-message assertion and add the recorded pull assertion; and at
lines 152-153, assert the indexed pull target
registry.example.com/myorg/migration-db.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a3e39493-bcca-4210-b8a8-4d754889de81

📥 Commits

Reviewing files that changed from the base of the PR and between b03e044 and f1735e9.

📒 Files selected for processing (1)
  • .vortex/tooling/tests/unit/fetch-db-container-registry.bats

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

1 similar comment
@AlexSkrypnyk

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Aug 5, 2026
@AlexSkrypnyk AlexSkrypnyk changed the title Migrated the BATS tests to the development version of 'bats-helpers'. Upgraded the BATS tests to 'bats-helpers' 2.0. Aug 5, 2026
@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

Renamed deprecated helpers to their current names.
…tests.

The registry login script is invoked by its own path rather than through PATH, so it runs for real and its 'docker login' is a mocked call in its own right. The S3 response is set on a pre-created mock because a step string is split with 'read' and cannot carry a newline.
The step output field expands backslash escapes again, so the two-line response no longer needs a pre-created mock.
…rget.

The existing-host test now names and asserts the fetch that follows, and the default-registry test checks the pull target where the resolved registry is the only evidence of it.
Replaces the development branch reference now that the release the suite was validated against is on the registry.
@AlexSkrypnyk
AlexSkrypnyk force-pushed the feature/bats-helpers-dev branch from 14e2538 to 6de1dd9 Compare August 5, 2026 22:10
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (206/209)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (206/209)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk
AlexSkrypnyk merged commit 7175b12 into main Aug 5, 2026
36 checks passed
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/bats-helpers-dev branch August 5, 2026 22:51
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

1 participant