feat: extend enterprise gateway policies billing protocols and operations
This commit is contained in:
1 parent
1528b71882
commit
af43947b5d
67 files changed
+1822
-69
No files matched your search
@@ -0,0 +1,34 @@
|
||||
"""Run all Java tests against a fresh, local-only PostgreSQL cluster; never production."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import socket
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
repo = Path(__file__).resolve().parent.parent
|
||||
pg = Path(r'C:\Program Files\PostgreSQL\17\bin')
|
||||
folder = Path(tempfile.mkdtemp(prefix='enterprise-test-', dir=repo / '.tools'))
|
||||
with socket.socket() as sock:
|
||||
sock.bind(('127.0.0.1', 0))
|
||||
port = sock.getsockname()[1]
|
||||
env = os.environ.copy()
|
||||
env['JAVA_HOME'] = str(repo / '.tools/jdk-build-22')
|
||||
env['MOYI_AUTH_TEST_JDBC_URL'] = f'jdbc:postgresql://127.0.0.1:{port}/postgres'
|
||||
|
||||
def run(command, name, timeout=120):
|
||||
with (folder / name).open('wb') as output:
|
||||
result = subprocess.run([str(x) for x in command], cwd=repo, env=env, stdout=output,
|
||||
stderr=subprocess.STDOUT, timeout=timeout,
|
||||
creationflags=getattr(subprocess, 'CREATE_NO_WINDOW', 0))
|
||||
if result.returncode:
|
||||
print((folder / name).read_text(encoding='utf-8', errors='replace')[-14000:])
|
||||
raise RuntimeError(f'{name} failed ({result.returncode})')
|
||||
|
||||
run([pg / 'initdb.exe', '-D', folder / 'data', '-U', 'moyi_role_test', '-A', 'trust', '--encoding=UTF8', '--locale=C'], 'init.log')
|
||||
try:
|
||||
run([pg / 'pg_ctl.exe', '-D', folder / 'data', '-l', folder / 'postgres.log', '-o', f'-p {port} -h 127.0.0.1', '-w', 'start'], 'start.log')
|
||||
print(f'Isolated PostgreSQL ready on 127.0.0.1:{port}; logs: {folder}', flush=True)
|
||||
run([repo / '.tools/apache-maven-3.9.9/bin/mvn.cmd', '-B', '-ntp', '-Dmaven.repo.local=.tools/m2', '-f', 'control-plane-java/pom.xml', 'test'], 'tests.log', 600)
|
||||
print((folder / 'tests.log').read_text(encoding='utf-8', errors='replace')[-3500:])
|
||||
finally:
|
||||
run([pg / 'pg_ctl.exe', '-D', folder / 'data', '-w', 'stop', '-m', 'fast'], 'stop.log')
|
||||
Reference in new issue
Block a user