mirror of
https://github.com/getsentry/self-hosted.git
synced 2025-12-08 19:46:14 +00:00
We should do the backup/restore tests _after_ we do the basic tests. This is both more efficient as we avoid an extra up/down cycle and more meaningful as we will back up and restore an actually used system. A bit hard to measure directly as this also moves the initial `docker compose up -w` into the test suite but a random run without this patch took about 10m 49s to finish for the testing part whereas with the patch it came down to 9m 10s so **almost 2 minutes faster**!
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
import os
|
|
from os.path import join
|
|
import subprocess
|
|
|
|
import pytest
|
|
|
|
SENTRY_CONFIG_PY = "sentry/sentry.conf.py"
|
|
SENTRY_TEST_HOST = os.getenv("SENTRY_TEST_HOST", "http://localhost:9000")
|
|
TEST_USER = "test@example.com"
|
|
TEST_PASS = "test123TEST"
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def configure_self_hosted_environment(request):
|
|
subprocess.run(
|
|
["docker", "compose", "--ansi", "never", "up", "--wait"],
|
|
check=True,
|
|
capture_output=True,
|
|
)
|
|
# Create test user
|
|
subprocess.run(
|
|
[
|
|
"docker",
|
|
"compose",
|
|
"exec",
|
|
"-T",
|
|
"web",
|
|
"sentry",
|
|
"createuser",
|
|
"--force-update",
|
|
"--superuser",
|
|
"--email",
|
|
TEST_USER,
|
|
"--password",
|
|
TEST_PASS,
|
|
"--no-input",
|
|
],
|
|
check=True,
|
|
text=True,
|
|
)
|
|
|
|
|
|
@pytest.fixture()
|
|
def setup_backup_restore_env_variables():
|
|
os.environ["SENTRY_DOCKER_IO_DIR"] = os.path.join(os.getcwd(), "sentry")
|
|
os.environ["SKIP_USER_CREATION"] = "1"
|