76 lines
4.1 KiB
Markdown
76 lines
4.1 KiB
Markdown
# Bortstack Testing Toolkit
|
|
|
|
This package is copied into generated applications. `scripts/testtask.sh` starts,
|
|
checks, or stops a **manual development environment**. `scripts/testrunner.sh`
|
|
runs configured automated suites. Both use `scripts/target.py` to select a Git
|
|
worktree; neither needs Forge at runtime. This package does not migrate existing
|
|
Roborto application launchers. Forge's earlier `distribution/testtask` is a
|
|
separate existing-project automated runner and remains unchanged for its
|
|
previously accepted scope.
|
|
|
|
The project needs a local Git repository. An unborn initial branch works for
|
|
no-target commands, so a newly generated project can use `--git-init` without
|
|
making a commit. A generated project created without Git must initialise it
|
|
before using the toolkit.
|
|
|
|
The application owns `.bortstack/testing.json` (see
|
|
`config/testing.example.json`). A no-argument command uses the current worktree
|
|
and its checked-out branch. A branch name uses its existing worktree; a task ID
|
|
uses `docs/TASKS.md` headings and `Branch/worktree: \`name\`` references or a
|
|
matching branch slug. A branch needs no task record. Missing, ambiguous, and
|
|
detached targets fail without Git mutation.
|
|
|
|
## Manual environments
|
|
|
|
`./scripts/testtask.sh [target] [--start|--status|--stop]` starts by default.
|
|
The current adapter supports Docker Compose. It uses a unique project name
|
|
derived from the selected worktree and branch, checks declared host ports,
|
|
starts only that project, verifies configured loopback readiness URLs, and
|
|
prints configured URLs. `--stop` runs Compose `stop` for that project; it never
|
|
removes volumes, databases, worktrees, or another project's containers. A
|
|
running project is reported without restarting it. Define project-specific
|
|
Compose services, ports, URLs, and optional account provisioning in the
|
|
application configuration. Do not configure production resources here.
|
|
|
|
For authentication, create `~/.config/bortstack/testing.env` with mode 0600:
|
|
|
|
```dotenv
|
|
BORTSTACK_TEST_EMAIL=test@localhost
|
|
BORTSTACK_TEST_PASSWORD=choose-a-private-local-password
|
|
```
|
|
|
|
`$XDG_CONFIG_HOME/bortstack/testing.env` is also accepted, and
|
|
`$XDG_CONFIG_HOME/bortstack/<project>/testing.env` can override either value.
|
|
The parser accepts only these two literal keys; it does not evaluate shell
|
|
code. The launcher asks before using defaults. Selecting N prompts for a new
|
|
email and hidden password without saving them. With no terminal, use
|
|
`--use-default-credentials` explicitly. Required credentials without a
|
|
configured local provisioning hook fail before startup. A hook receives only
|
|
the path in `BORTSTACK_CREDENTIALS_FILE` to a temporary mode-0600 JSON file;
|
|
it must never print or forward the password as a command argument. The generic
|
|
toolkit cannot promise an account exists until the project hook succeeds.
|
|
|
|
## Automated suites
|
|
|
|
`./scripts/testrunner.sh [target] [--unit] [--integration] [--act] [--all]` runs
|
|
the configured default suites when no option is supplied. Explicit suites can
|
|
be combined. `--all` includes every configured suite and only allowlisted act
|
|
jobs. Commands are argument arrays and run in the selected worktree. The tool
|
|
prints each executed suite and exit code; missing configuration or dependencies
|
|
cannot count as a pass. Exit 2 denotes target errors, 3 configuration or
|
|
infrastructure unavailability, 4 unsafe/cancelled selection, and test commands
|
|
retain their own nonzero exit codes.
|
|
|
|
`act` needs its executable and a working Docker daemon. Each allowed job must
|
|
name a local `.github/workflows/` file and job. A conservative content check
|
|
rejects obvious deployment, publishing, release, push, secret, and production
|
|
operations even if listed. Review the whole workflow before allowlisting it;
|
|
static checks cannot prove a workflow harmless. No user credentials or secrets
|
|
are passed to `act`. An act pass is local evidence, not a GitHub-hosted result.
|
|
|
|
Linux requires Python 3, Git, a POSIX shell and Docker Compose for manual
|
|
Compose environments. Windows contributors can use WSL2 with Git, Python,
|
|
Docker Desktop's WSL integration, and the project toolchain. Git Bash may work
|
|
if Docker, Python, and all project commands are available there. Windows has
|
|
not been exercised in this implementation.
|