Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ venv
.vscode/tags
.pytest_cache
.hypothesis
semaphore
relay
pip-wheel-metadata
.mypy_cache
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ install:
- pip install tox
- pip install codecov
- make install-zeus-cli
- bash scripts/download-semaphore.sh
- bash scripts/download-relay.sh

script:
- coverage erase
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
pip --version
pip install tox
pip install codecov
sh scripts/download-semaphore.sh
sh scripts/download-relay.sh
displayName: "Install dependencies"

- script: |
Expand Down
6 changes: 3 additions & 3 deletions scripts/download-semaphore.sh → scripts/download-relay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ if { [ "$TRAVIS" == "true" ] || [ "$TF_BUILD" == "True" ]; } && [ -z "$GITHUB_AP
exit 0;
fi

target=semaphore
target=relay

# Download the latest semaphore release for Travis
# Download the latest relay release for Travis

output="$(
curl -s \
https://api.github.com/repos/getsentry/semaphore/releases/latest?access_token=$GITHUB_API_TOKEN
https://api.github.com/repos/getsentry/relay/releases/latest?access_token=$GITHUB_API_TOKEN
)"

echo "$output"
Expand Down
22 changes: 11 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

from tests import _warning_recorder, _warning_recorder_mgr

SEMAPHORE = "./semaphore"
SENTRY_RELAY = "./relay"

if not os.path.isfile(SEMAPHORE):
SEMAPHORE = None
if not os.path.isfile(SENTRY_RELAY):
SENTRY_RELAY = None


try:
Expand Down Expand Up @@ -117,7 +117,7 @@ def _capture_internal_warnings():


@pytest.fixture
def monkeypatch_test_transport(monkeypatch, semaphore_normalize):
def monkeypatch_test_transport(monkeypatch, relay_normalize):
def check_event(event):
def check_string_keys(map):
for key, value in iteritems(map):
Expand All @@ -127,16 +127,16 @@ def check_string_keys(map):

with capture_internal_exceptions():
check_string_keys(event)
semaphore_normalize(event)
relay_normalize(event)

def inner(client):
monkeypatch.setattr(client, "transport", TestTransport(check_event))

return inner


def _no_errors_in_semaphore_response(obj):
"""Assert that semaphore didn't throw any errors when processing the
def _no_errors_in_relay_response(obj):
"""Assert that relay didn't throw any errors when processing the
event."""

def inner(obj):
Expand All @@ -156,9 +156,9 @@ def inner(obj):


@pytest.fixture
def semaphore_normalize(tmpdir):
def relay_normalize(tmpdir):
def inner(event):
if not SEMAPHORE:
if not SENTRY_RELAY:
return

# Disable subprocess integration
Expand All @@ -169,10 +169,10 @@ def inner(event):
with file.open() as f:
output = json.loads(
subprocess.check_output(
[SEMAPHORE, "process-event"], stdin=f
[SENTRY_RELAY, "process-event"], stdin=f
).decode("utf-8")
)
_no_errors_in_semaphore_response(output)
_no_errors_in_relay_response(output)
output.pop("_meta", None)
return output

Expand Down
4 changes: 2 additions & 2 deletions tests/integrations/aws_lambda/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def lambda_client():


@pytest.fixture(params=["python3.6", "python3.7", "python3.8", "python2.7"])
def run_lambda_function(tmpdir, lambda_client, request, semaphore_normalize):
def run_lambda_function(tmpdir, lambda_client, request, relay_normalize):
def inner(code, payload):
runtime = request.param
tmpdir.ensure_dir("lambda_tmp").remove()
Expand Down Expand Up @@ -107,7 +107,7 @@ def delete_function():
continue
line = line[len(b"EVENT: ") :]
events.append(json.loads(line.decode("utf-8")))
semaphore_normalize(events[-1])
relay_normalize(events[-1])

return events, response

Expand Down
16 changes: 8 additions & 8 deletions tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
)
)
@example(dt=datetime(2001, 1, 1, 0, 0, 0, 999500))
def test_datetime_precision(dt, semaphore_normalize):
def test_datetime_precision(dt, relay_normalize):
event = serialize({"timestamp": dt})
normalized = semaphore_normalize(event)
normalized = relay_normalize(event)

if normalized is None:
pytest.skip("no semaphore available")
pytest.skip("no relay available")

dt2 = datetime.utcfromtimestamp(normalized["timestamp"])

# Float glitches can happen, and more glitches can happen
# because we try to work around some float glitches in semaphore
# because we try to work around some float glitches in relay
assert (dt - dt2).total_seconds() < 1.0

@given(binary=st.binary(min_size=1))
Expand All @@ -43,13 +43,13 @@ def test_bytes_serialization_repr_many(binary, message_normalizer):


@pytest.fixture
def message_normalizer(semaphore_normalize):
if semaphore_normalize({"test": "test"}) is None:
pytest.skip("no semaphore available")
def message_normalizer(relay_normalize):
if relay_normalize({"test": "test"}) is None:
pytest.skip("no relay available")

def inner(message, **kwargs):
event = serialize({"logentry": {"message": message}}, **kwargs)
normalized = semaphore_normalize(event)
normalized = relay_normalize(event)
return normalized["logentry"]["message"]

return inner
Expand Down