mirror of
https://github.com/mudler/LocalAI.git
synced 2026-11-05 20:13:23 -05:00
test(addons): list suite cases once
suites.json kept the required cases of a Ginkgo suite twice: once at the top level and once per report. The two copies drifted in #13034 and broke the CI gate on master. For a suite with reports, verify.sh now builds the required cases from the reports, and refuses a suite that still has a top-level list. Suites with a single report keep their one list. The redundant lists are removed from suites.json, and prerequisites_test.sh covers the refusal. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
3 files changed
+15
-2101
No files matched your search
@@ -135,10 +135,15 @@ reject contracts-empty 'Ginkgo report' env PATH="$fixture/bin:$PATH" FIXTURE_REP
|
||||
reject contracts-skipped 'Ginkgo report' env PATH="$fixture/bin:$PATH" FIXTURE_REPORT='[{"SuiteSucceeded":true,"SpecReports":[{"State":"skipped","LeafNodeType":"It","LeafNodeText":"sqlite transaction"}]}]' sh "$verify" contracts
|
||||
# Every gateway report is mandatory, including a missing second report.
|
||||
cat > "$fixture/scripts/addons/suites.json" <<'JSON'
|
||||
{"gateway":{"kind":"ginkgo","commands":[["go","test","-count=1","-tags","auth","./fixture"]],"cases":["sqlite transaction","http"],"report":".cache/report.json","reports":[{"path":".cache/report.json","cases":["sqlite transaction"]},{"path":".cache/second.json","cases":["http"]}]}}
|
||||
{"gateway":{"kind":"ginkgo","commands":[["go","test","-count=1","-tags","auth","./fixture"]],"report":".cache/report.json","reports":[{"path":".cache/report.json","cases":["sqlite transaction"]},{"path":".cache/second.json","cases":["http"]}]}}
|
||||
JSON
|
||||
reject gateway-missing-report 'Ginkgo report' env PATH="$fixture/bin:$PATH" FIXTURE_REPORT='[{"SuiteSucceeded":true,"SpecReports":[{"State":"passed","LeafNodeType":"It","LeafNodeText":"sqlite transaction"}]}]' sh "$verify" gateway
|
||||
reject gateway-skipped-report 'Ginkgo report' env PATH="$fixture/bin:$PATH" FIXTURE_REPORT='[{"SuiteSucceeded":true,"SpecReports":[{"State":"skipped","LeafNodeType":"It","LeafNodeText":"sqlite transaction"}]}]' sh "$verify" gateway
|
||||
# The same cases listed at the top level and per report would drift apart.
|
||||
cat > "$fixture/scripts/addons/suites.json" <<'JSON'
|
||||
{"gateway":{"kind":"ginkgo","commands":[["go","test","-count=1","-tags","auth","./fixture"]],"cases":["sqlite transaction"],"report":".cache/report.json","reports":[{"path":".cache/report.json","cases":["sqlite transaction"]}]}}
|
||||
JSON
|
||||
reject cases-listed-twice 'lists its cases twice' env PATH="$fixture/bin:$PATH" sh "$verify" gateway
|
||||
# Pin/browser setup fixtures never build or download: make their disk
|
||||
# prerequisite deterministic without bypassing the real preparation gate.
|
||||
cat > "$fixture/bin/df" <<'TOOL'
|
||||
|
||||
+1
-2097
File diff suppressed because it is too large.
Load diff
@@ -12,7 +12,12 @@ inventory = json.loads((root / 'scripts/addons/suites.json').read_text())
|
||||
if suite not in inventory:
|
||||
sys.exit('unknown or unavailable suite: ' + suite)
|
||||
entry = inventory[suite]
|
||||
if not entry.get('commands') or not entry.get('cases'):
|
||||
# A suite with per-report inventories takes its required cases from them, so
|
||||
# a case is listed once. A second list drifts and breaks the gate.
|
||||
if 'reports' in entry and 'cases' in entry:
|
||||
sys.exit('suite lists its cases twice: drop the top-level cases, the reports carry them')
|
||||
expected = [c for r in entry['reports'] for c in r['cases']] if 'reports' in entry else entry.get('cases')
|
||||
if not entry.get('commands') or not expected:
|
||||
sys.exit('empty command/test inventory')
|
||||
cache = root / '.cache/addons'
|
||||
(cache / 'logs').mkdir(parents=True, exist_ok=True)
|
||||
@@ -65,7 +70,7 @@ from ginkgo_report import ginkgo_report
|
||||
|
||||
seen = []
|
||||
if entry['kind'] == 'ginkgo':
|
||||
reports = entry.get('reports', [dict(path=entry['report'], cases=entry['cases'])])
|
||||
reports = entry['reports'] if 'reports' in entry else [dict(path=entry['report'], cases=entry['cases'])]
|
||||
if not reports: sys.exit('empty report inventory')
|
||||
for report in reports: (root/report['path']).unlink(missing_ok=True)
|
||||
for command in entry['commands']:
|
||||
@@ -80,7 +85,7 @@ for command in entry['commands']:
|
||||
if entry['kind'] == 'ginkgo':
|
||||
seen = []
|
||||
for report in reports: seen.extend(ginkgo_report(root/report['path'], report['cases'], report.get('focus')))
|
||||
if sorted(seen) != sorted(entry['cases']):
|
||||
if sorted(seen) != sorted(expected):
|
||||
sys.exit('required case inventory mismatch: '+repr(seen))
|
||||
# Run real readiness only after the shell test inventory has passed.
|
||||
run(['sh', 'scripts/addons/prepare.sh', '--check'])
|
||||
|
||||
Reference in new issue
Block a user