scripts
This commit is contained in:
@@ -9,13 +9,13 @@
|
||||
"ports": {"BORTSTACK_API_PORT": 5001, "BORTSTACK_WEB_PORT": 8081},
|
||||
"readiness": ["http://127.0.0.1:5001/api/health/ready", "http://127.0.0.1:8081/"],
|
||||
"urls": ["http://127.0.0.1:8081/"],
|
||||
"authentication": {"required": true, "provision": ["python3", "scripts/provision-test-user.py"]}
|
||||
"authentication": {"required": true, "provision": ["python3", ".bortstack/testing/provision-test-user.py"]}
|
||||
},
|
||||
"automated": {
|
||||
"default": ["unit"],
|
||||
"suites": {
|
||||
"unit": {"command": ["./scripts/run-unit-tests.sh"], "cwd": "."},
|
||||
"integration": {"command": ["./scripts/run-integration-tests.sh"], "cwd": "."}
|
||||
"unit": {"command": ["./.bortstack/testing/run-unit-tests.sh"], "cwd": "."},
|
||||
"integration": {"command": ["./.bortstack/testing/run-integration-tests.sh"], "cwd": "."}
|
||||
},
|
||||
"act": []
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/../../.." && pwd)
|
||||
if [ ! -d "$root/react/node_modules" ]; then
|
||||
echo 'integration tests unavailable: install react/node_modules first' >&2
|
||||
exit 3
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/../../.." && pwd)
|
||||
if [ ! -x "$root/api/.venv/bin/python" ] || [ ! -d "$root/react/node_modules" ]; then
|
||||
echo 'unit tests unavailable: install api/.venv and react/node_modules first' >&2
|
||||
exit 3
|
||||
@@ -28,9 +28,10 @@ The generated testing toolkit is available without Forge at runtime:
|
||||
./scripts/testtask.sh --stop # stops only this worktree's Compose project
|
||||
./scripts/testrunner.sh --unit
|
||||
./scripts/testrunner.sh --integration
|
||||
./scripts/create-chatgpt-snapshot.sh # ZIP of the current checkout after the first commit
|
||||
```
|
||||
|
||||
The toolkit uses Git worktree metadata. Generate with `--git-init` or initialise
|
||||
Testing helpers are under `.bortstack/testing/`. The toolkit uses Git worktree metadata. Generate with `--git-init` or initialise
|
||||
Git locally before using the commands; an initial commit is not required for
|
||||
the current worktree. Explicit branch targets require a local branch ref and
|
||||
an existing checkout.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
exec python3 "$repo/.bortstack/create-chatgpt-snapshot.py" "$repo"
|
||||
@@ -8,7 +8,8 @@ from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
TOOLKIT = ROOT.parent.parent / "toolkits/testing/scripts"
|
||||
FORGE = ROOT.parent.parent
|
||||
TOOLKIT = FORGE / "toolkits/testing"
|
||||
TOKEN_FILES = (".env.example", "docker-compose.yml", "react/index.html",
|
||||
".bortstack/testing.json",
|
||||
"react/src/config/site.js", "react/src/components/Logo/Logo.jsx",
|
||||
@@ -31,10 +32,15 @@ def generate(name, destination, git_init=False):
|
||||
raise ValueError("destination parent must already exist")
|
||||
target.mkdir()
|
||||
try:
|
||||
shutil.copytree(ROOT / "source", target, symlinks=False, dirs_exist_ok=True)
|
||||
shutil.copytree(ROOT / "boilerplate", target, dirs_exist_ok=True)
|
||||
for tool_name in ("testtask.sh", "testrunner.sh", "target.py", "toolkit.py"):
|
||||
shutil.copy2(TOOLKIT / tool_name, target / "scripts" / tool_name)
|
||||
ignore_cache = shutil.ignore_patterns("__pycache__")
|
||||
shutil.copytree(ROOT / "source", target, dirs_exist_ok=True, ignore=ignore_cache)
|
||||
shutil.copytree(ROOT / "boilerplate", target, dirs_exist_ok=True, ignore=ignore_cache)
|
||||
for tool_name in ("testtask.sh", "testrunner.sh"):
|
||||
shutil.copy2(TOOLKIT / "scripts" / tool_name, target / "scripts" / tool_name)
|
||||
for module in ("target.py", "toolkit.py"):
|
||||
shutil.copy2(TOOLKIT / "runtime" / module, target / ".bortstack/testing" / module)
|
||||
shutil.copy2(FORGE / "scripts/create-chatgpt-snapshot.py",
|
||||
target / ".bortstack/create-chatgpt-snapshot.py")
|
||||
values = {"__PROJECT_NAME__": name, "__APP_SLUG__": slug,
|
||||
"__DATABASE_NAME__": slug.replace("-", "_")}
|
||||
for relative in TOKEN_FILES:
|
||||
|
||||
@@ -19,3 +19,6 @@ test-results/
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
*.db
|
||||
|
||||
/snapshots/
|
||||
/.test-worktrees/
|
||||
|
||||
Reference in New Issue
Block a user