Repository navigation
test: bats suite, real-DDEV e2e, CI and template alignment - #13
Merged
Merged
Conversation
- tests/ runs both commands against a fake ddev in an isolated sandbox
(own HOME and TMPDIR), so it needs no Docker. It covers clone creation,
DB transfer and cleanup, branch handling, name sanitizing, the
collision and --force protections, profiles, removal (including
clones named by older versions), the safety check, --list and
packaging (install.yaml, #ddev-generated, Flags JSON).
- One test is skipped: with omit_project_name_by_default and no name in
config.yaml, the command stops before the omit logic (existing bug).
- Fixes the shellcheck findings: quote expansions inside ${..} so
project names aren't matched as patterns, drop an unused variable,
and replace an echo|sed with a read loop.
- GitHub Actions runs shellcheck and bats on Linux and macOS for every
PR and every push to main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…license Follows DDEV's add-on maintenance guide and ddev/ddev-addon-template: - tests/test.bats is an end-to-end test on real DDEV, in the template's format: it installs the add-on from the directory (and, on scheduled runs, from the release), creates a clone, checks it runs, serves the site and has the source's database, then lists and removes it. It installs into ~/.ddev, so it skips outside CI unless DDEV_WORKTREE_E2E=1. - The fake-ddev suite moves to tests/unit/. - tests.yml gains the template's e2e job (ddev/github-action-add-on-test@v2, DDEV stable and HEAD on amd64 and arm64), a nightly schedule, manual runs with debugging, paths-ignore for Markdown, concurrency and read-only permissions. The unit job keeps macOS for the host commands. - ddev_version_constraint is now '>= v1.24.10', the guide's current recommendation. - The commands use #!/usr/bin/env bash, as the guide recommends. - README: template badges, updated Development section, License section. - .gitattributes keeps tests/ and .github/ out of release tarballs. - LICENSE: MIT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tests/unit/adopt.bats: 24 tests for `ddev worktree --path` and its
removal (refusals, external marker, files kept, failed-delete
handling, cross-project and name lookups, --list).
- The fake ddev can make `ddev list` fail (DDEV_LIST_RC).
- Quote ${SOURCE_PROJECT} inside two ${..} expansions from #12.
- Restore `CONFIG_WORKTREE=$(worktree_config ...)` in worktree-remove.
An earlier shellcheck cleanup on this branch dropped the variable
while it was unused; #12 now reads it to recognise adopted worktrees,
and without it removal deleted their files. main was never affected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `! cmd` and `[[ ... ]]` that aren't a test's last line don't fail the test (bats ignores `!`; bash 3.2 on macOS ignores `[[ ]]` under set -e). Append `|| false` to all 40 such lines. Verified: the --no-db test now catches --no-db being ignored, and the profile-list test now catches a changed bullet on /bin/bash 3.2. - Set GIT_CONFIG_GLOBAL=/dev/null and GIT_CONFIG_NOSYSTEM=1 so a host config like commit.gpgsign=true can't break make_source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds automated tests and CI, and lines the repo up with DDEV's add-on maintenance guide and ddev-addon-template.
Tests
tests/test.bats: end-to-end on real DDEV, in the template's format. It installs the add-on from the directory, runsddev worktree feat-e2e, and checks that the clone:Then it runs
--listandddev worktree-remove. Scheduled runs also install from the latest release. It installs into~/.ddev, so outside CI it skips unlessDDEV_WORKTREE_E2E=1.tests/unit/: 62 fast tests with a fakeddev. No Docker needed; they run in seconds and cover:--forceprotections;--list;--path(feat: adopt worktrees created by other tools with --path #12): refusals, files kept on removal, failedddev deletehandling, lookups across projects and by name.CI (
.github/workflows/tests.yml)/bin/bash3.2 with BSD tools.ddev/github-action-add-on-test@v2on DDEV stable and HEAD, amd64 and arm64.main, nightly, and manual runs with debugging. Markdown-only changes are skipped, superseded runs are cancelled, and permissions are read-only.Template alignment
install.yaml:ddev_version_constraint: '>= v1.24.10', the guide's current recommendation. This raises the minimum DDEV version from v1.24.0.#!/usr/bin/env bashin both commands..gitattributes: keepstests/and.github/out of release tarballs.LICENSE: MIT.Fixes found along the way
${..}so project names aren't matched as glob patterns. Two of these came from feat: adopt worktrees created by other tools with --path #12.omit_project_name_by_default: trueand noname:in.ddev/config.yaml, the command stops at "Could not determine project name" before the omit logic runs. Left for a separate fix.Not in this PR (repo settings)
ddev-gettopic and a description, so the add-on appears inddev add-on list --alland on addons.ddev.com.main.🤖 Generated with Claude Code