Реализовать лабораторную работу 3
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user