Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3986b36176
|
No files matched your search
@@ -52,6 +52,7 @@ jobs:
|
||||
bash tests/test_cli_ci_behavior.sh
|
||||
python3 tests/test_cli_ci_contract.py
|
||||
python3 tests/test_maven_ci_contract.py
|
||||
python3 tests/test_version_preflight.py
|
||||
python3 tests/test_standardize_qbit.py
|
||||
python3 tests/test_qbit_hotfix_profile.py
|
||||
python3 tests/test_qbit_feature_profile.py
|
||||
|
||||
@@ -55,6 +55,7 @@ test-all: test test-scripts test-pipelines
|
||||
test-pipelines: pack
|
||||
python3 tests/test_generate_pipeline.py --packed target/qqq-orb-packed.yml
|
||||
python3 tests/test_maven_ci_contract.py
|
||||
python3 tests/test_version_preflight.py
|
||||
bash tests/test_cli_ci_behavior.sh
|
||||
python3 tests/test_cli_ci_contract.py
|
||||
python3 tests/test_standardize_qbit.py
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Maven version preflight
|
||||
|
||||
The shared QQQ Maven version calculator rejects coordinates longer than 50
|
||||
characters before changing POM files or starting versioned verification/deployment.
|
||||
This applies to unchanged coordinates too. It does not shorten names, change commit
|
||||
hashes, or expand runtime/storage limits. Use a shorter feature branch for snapshots.
|
||||
|
||||
The limit matches HelpBundles.load and HelpContent.bundleVersion's maxLength=50
|
||||
in core. This is a shared publication constraint, including Maven artifacts without
|
||||
bundles, so future bundle adoption cannot introduce incompatible coordinates.
|
||||
|
||||
Validation: 49/50/51-character boundaries, the original long feature branch,
|
||||
unchanged oversized coordinates, and representative core/collaboration/Redis/session
|
||||
and RC coordinates; no Maven mutation on failure. Existing calculator35 and
|
||||
publication-contract5 tests pass. New Python tests run in the contract CI suite.
|
||||
|
||||
Issue QRun-IO/qqq#1312 remains open: actual filtered-resource coverage and the
|
||||
runtime loader's misleading error require follow-up. The current job can perform
|
||||
its initial unversioned compile before version calculation; this guard prevents
|
||||
version mutation and subsequent versioned verification/deployment, not all setup.
|
||||
@@ -435,6 +435,13 @@ main() {
|
||||
echo ""
|
||||
echo "Calculated next version: $NEW_VERSION"
|
||||
echo ""
|
||||
|
||||
# QQQ help bundle versions and persisted provenance support at most 50 characters.
|
||||
# Check unchanged versions too, before Maven edits or publication can begin.
|
||||
if (( ${#NEW_VERSION} > 50 )); then
|
||||
echo "ERROR: Calculated version '$NEW_VERSION' is ${#NEW_VERSION} characters; QQQ bundle/provenance versions support at most 50. Use a shorter feature branch name or version." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#######################################
|
||||
## Set the version if it's different ##
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Exercise the actual version calculator before any Maven mutation."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
class VersionPreflightTests(unittest.TestCase):
|
||||
def calculate(self, version, branch, dry_run=True):
|
||||
with tempfile.TemporaryDirectory() as scratch:
|
||||
folder = Path(scratch)
|
||||
pom = folder / 'pom.xml'
|
||||
original = f'<project><revision>{version}</revision></project>\n'
|
||||
pom.write_text(original)
|
||||
for name, body in (('git', 'echo abc1234'), ('mvn', 'echo invoked >> "$PWD/maven-called"; exit 99')):
|
||||
command = folder / name
|
||||
command.write_text('#!/bin/sh\n' + body + '\n')
|
||||
command.chmod(0o755)
|
||||
env = dict(os.environ, CIRCLE_BRANCH=branch, PATH=str(folder) + os.pathsep + os.environ['PATH'])
|
||||
result = subprocess.run(['bash', str(ROOT / 'src/scripts/calculate_version.sh')]
|
||||
+ (['--dry-run'] if dry_run else []),
|
||||
cwd=folder, env=env, text=True, capture_output=True, timeout=10)
|
||||
self.assertEqual(pom.read_text(), original)
|
||||
self.assertFalse((folder / 'maven-called').exists())
|
||||
return result
|
||||
|
||||
def test_generated_boundary_and_original_failure(self):
|
||||
for size in (49, 50, 51):
|
||||
with self.subTest(size=size):
|
||||
result = self.calculate('1.2.3-SNAPSHOT', 'feature/' + 'a' * (size - 23))
|
||||
self.assertEqual(result.returncode, 0 if size <= 50 else 1, result.stdout + result.stderr)
|
||||
if size > 50:
|
||||
self.assertIn('51 characters', result.stderr)
|
||||
self.assertIn('at most 50', result.stderr)
|
||||
result = self.calculate('4.1.0-SNAPSHOT', 'feature/collaboration-production-20261021', False)
|
||||
self.assertEqual(result.returncode, 1)
|
||||
self.assertIn('Use a shorter feature branch', result.stderr)
|
||||
|
||||
def test_existing_oversized_version(self):
|
||||
result = self.calculate('1.2.3-' + 'b' * 28 + '-abc1234-SNAPSHOT', 'maintenance/check', False)
|
||||
self.assertEqual(result.returncode, 1)
|
||||
self.assertIn('51 characters', result.stderr)
|
||||
|
||||
def test_candidate_coordinates_unchanged(self):
|
||||
for version in ('4.1.0-collab-33464d37e-SNAPSHOT', '0.1.0-collab-8f348da-SNAPSHOT',
|
||||
'0.1.0-redis-7fe5492-SNAPSHOT', '0.1.0-session-b5276ab-SNAPSHOT', '1.0.0-RC.37'):
|
||||
with self.subTest(version=version):
|
||||
result = self.calculate(version, 'maintenance/check')
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.assertIn('Calculated next version: ' + version, result.stdout)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user