test(billing): odoo-trial Enterprise test runner + plan test-env fix
Local dev Odoo is Community (can't install the module). Add a guest-exec runner that syncs the module to the odoo-trial Enterprise sandbox (VM 316, db trial) and runs --test-enable there; pass = FCB_EXIT=0. Scaffold verified installing on Odoo 19.0 Enterprise (7 fusion_billing_* tables created). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,17 +25,19 @@
|
||||
|
||||
## Test environment
|
||||
|
||||
The module depends on Enterprise modules, so tests run on an instance that has them. Use the dev container (it bind-mounts `Odoo-Modules` at `/mnt/odoo-modules`):
|
||||
**Verified 2026-05-27.** The local dev Odoo (`odoo-modsdev`) is **Community** and CANNOT install this module (no `sale_subscription`/`account_accountant`). Tests run on the **odoo-trial** Enterprise sandbox (Proxmox VM 316, Odoo 19.0 Enterprise, db `trial`), reached via Proxmox guest-exec (VM 316 has no direct SSH — only `qm guest exec` through `pve-worker1`). A committed runner handles sync + test:
|
||||
|
||||
```bash
|
||||
docker exec odoo-modsdev-app odoo -d fusion-dev \
|
||||
-i fusion_centralize_billing --test-enable \
|
||||
--test-tags /fusion_centralize_billing --stop-after-init
|
||||
bash scripts/fcb_test_on_trial.sh
|
||||
```
|
||||
|
||||
- First run uses `-i` (install); later runs use `-u` (upgrade).
|
||||
- **Never** run `--test-enable -u` against production `nexamain`. If the dev instance lacks Enterprise addons, provision a throwaway test DB on `odoo-nexa` and run there.
|
||||
- A task "passes" when the run ends with `0 failed, 0 error(s)` for the module's tags.
|
||||
It tars the module, ships it into odoo-trial's `/opt/odoo/custom-addons/`, then runs
|
||||
`odoo -d trial -u fusion_centralize_billing --no-http --workers 0 --test-enable --test-tags /fusion_centralize_billing --stop-after-init`.
|
||||
|
||||
- **Pass condition:** the output contains `FCB_EXIT=0` (Odoo exits non-zero on any test failure; failures also show as `FAIL`/`ERROR`/assert lines).
|
||||
- The scaffold is already installed on `trial` (7 `fusion_billing_*` tables verified). Each run re-syncs the latest local code and `-u` upgrades it.
|
||||
- **Never** run `--test-enable` against production `nexamain` (odoo-nexa).
|
||||
- Requires SSH access to `pve-worker1` (in the ssh config). Subagents run the same script — they do NOT use `odoo-modsdev` for this module.
|
||||
|
||||
## File structure (this plan)
|
||||
|
||||
|
||||
27
scripts/fcb_test_on_trial.sh
Normal file
27
scripts/fcb_test_on_trial.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Sync fusion_centralize_billing to the odoo-trial Enterprise sandbox (Proxmox VM 316)
|
||||
# and run its test suite there. The local dev Odoo (odoo-modsdev) is Community and
|
||||
# CANNOT install this module (needs sale_subscription + account_accountant), so tests
|
||||
# run on odoo-trial (Odoo 19.0 Enterprise, db=trial), reached via Proxmox guest-exec
|
||||
# (VM 316 has no direct SSH; only `qm guest exec` through the pve-worker1 host).
|
||||
#
|
||||
# Usage: bash scripts/fcb_test_on_trial.sh
|
||||
# Pass condition: the output ends with `FCB_EXIT=0` (Odoo exits non-zero on test failure).
|
||||
set -uo pipefail
|
||||
|
||||
MODULE=fusion_centralize_billing
|
||||
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PVE=pve-worker1 # Proxmox host that runs VM 316 (ssh config alias)
|
||||
VMID=316
|
||||
|
||||
echo ">> packing ${MODULE}"
|
||||
B64=$(tar czf - --exclude='__pycache__' --exclude='*.pyc' -C "${REPO_DIR}" "${MODULE}" | base64 -w0)
|
||||
echo " payload: ${#B64} b64 bytes"
|
||||
|
||||
echo ">> syncing to odoo-trial:/opt/odoo/custom-addons (guest-exec)"
|
||||
ssh -o ConnectTimeout=40 "${PVE}" "qm guest exec ${VMID} --timeout 90 -- bash -lc 'rm -rf /opt/odoo/custom-addons/${MODULE}; echo ${B64} | base64 -d | tar xzf - -C /opt/odoo/custom-addons/ && echo SYNCED'" \
|
||||
2>&1 | sed -n 's/.*"out-data" : "\(.*\)",/\1/p' | sed 's/\\n/\n/g'
|
||||
|
||||
echo ">> upgrade + test on Enterprise 19 (db=trial, --no-http)"
|
||||
ssh -o ConnectTimeout=40 "${PVE}" "qm guest exec ${VMID} --timeout 600 -- bash -lc 'docker exec odoo-trial-app odoo -d trial -u ${MODULE} --no-http --workers 0 --test-enable --test-tags /${MODULE} --stop-after-init >/tmp/fcb_test.log 2>&1; echo FCB_EXIT=\$?; grep -iE \"FAIL|ERROR|tested in|Ran |assert\" /tmp/fcb_test.log | grep -viE \"fusion_plating|fusion_tasks|not installable|not loaded\" | tail -30'" \
|
||||
2>&1 | sed -n 's/.*"out-data" : "\(.*\)",/\1/p' | sed 's/\\n/\n/g'
|
||||
Reference in New Issue
Block a user