21 lines
596 B
Python
21 lines
596 B
Python
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "tests"))
|
|
|
|
|
|
def compose(*args, timeout=90):
|
|
result = subprocess.run([str(ROOT / "scripts/compose.sh"), *args], cwd=ROOT,
|
|
text=True, capture_output=True, check=True, timeout=timeout)
|
|
return result.stdout.strip()
|
|
|
|
|
|
def sql(query):
|
|
return compose("exec", "-T", "postgres", "psql", "-X", "-U", "messenger", "-d", "messenger", "-Atc", query)
|
|
|
|
|
|
def redis(*args):
|
|
return compose("exec", "-T", "redis", "redis-cli", "--raw", *args)
|