Skip to content

Commit

Permalink
customization tests working finally?
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertdeng123 committed Mar 25, 2024
1 parent fbe3713 commit 1799f09
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 119 deletions.
2 changes: 1 addition & 1 deletion _integration-test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def configure_self_hosted_environment(request):
else:
raise AssertionError("timeout waiting for self-hosted to come up")

if request.config.getoption("--customizations"):
if request.config.getoption("--customizations") == "True":
os.environ['TEST_CUSTOMIZATIONS'] = "1"
script_content = '''\

Check warning on line 32 in _integration-test/conftest.py

View check run for this annotation

Codecov / codecov/patch

_integration-test/conftest.py#L31-L32

Added lines #L31 - L32 were not covered by tests
#!/bin/bash
Expand Down
175 changes: 57 additions & 118 deletions _integration-test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,121 +185,60 @@ def placeholder_fn():


def test_customizations():
if os.getenv("SENTRY_TEST_HOST", False):
subprocess.run(
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"web",
"bash",
"-c" "if [ ! -e /created-by-enhance-image ]; then exit 1; fi",
],
check=True,
)
subprocess.run(
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"--entrypoint=/etc/sentry/entrypoint.sh",
"sentry-cleanup",
"bash" "-c" "if [ ! -e /created-by-enhance-image ]; then exit 1; fi",
],
check=True,
)
subprocess.run(
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"web",
"python",
"-c" "import ldap",
],
check=True,
)
subprocess.run(
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"--entrypoint=/etc/sentry/entrypoint.sh",
"sentry-cleanup",
"python" "import ldap",
],
check=True,
)
else:
subprocess.run(
[
"!",
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"web",
"bash",
"-c" "if [ ! -e /created-by-enhance-image ]; then exit 1; fi",
],
check=True,
)
subprocess.run(
[
"!",
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"--entrypoint=/etc/sentry/entrypoint.sh",
"sentry-cleanup",
"bash" "-c" "if [ ! -e /created-by-enhance-image ]; then exit 1; fi",
],
check=True,
)
subprocess.run(
[
"!",
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"web",
"python",
"-c" "import ldap",
],
check=True,
)
subprocess.run(
[
"!",
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"--entrypoint=/etc/sentry/entrypoint.sh",
"sentry-cleanup",
"python" "import ldap",
],
check=True,
)
commands = [
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"web",
"bash",
"-c",
"if [ ! -e /created-by-enhance-image ]; then exit 1; fi",
],
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"--entrypoint=/etc/sentry/entrypoint.sh",
"sentry-cleanup",
"bash",
"-c",
"if [ ! -e /created-by-enhance-image ]; then exit 1; fi",
],
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"web",
"python",
"-c",
"import ldap",
],
[
"docker",
"compose",
"--ansi",
"never",
"run",
"--no-deps",
"--entrypoint=/etc/sentry/entrypoint.sh",
"sentry-cleanup",
"python",
"import ldap",
]
]
for command in commands:
result = subprocess.run(command, check=False)
if os.getenv("TEST_CUSTOMIZATIONS", "False") == "True":
assert result.returncode == 0

Check warning on line 242 in _integration-test/test_run.py

View check run for this annotation

Codecov / codecov/patch

_integration-test/test_run.py#L242

Added line #L242 was not covered by tests
else:
assert result.returncode != 0

0 comments on commit 1799f09

Please sign in to comment.