Skip to content

Commit f64c4c8

Browse files
committed
Update test asserts
1 parent d279f92 commit f64c4c8

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

tests/integration/test_ourlogs.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def test_ourlog_extraction_with_otel_logs(
8585
relay.send_envelope(project_id, envelope)
8686

8787
ourlogs = ourlogs_consumer.get_ourlogs()
88-
assert len(ourlogs) == 1
8988
expected = {
9089
"organization_id": 1,
9190
"project_id": 42,
@@ -98,6 +97,7 @@ def test_ourlog_extraction_with_otel_logs(
9897
"span_id": "eee19b7ec3c1b174",
9998
"severity_text": "Information",
10099
"severity_number": 10,
100+
"received": time_within_delta(start, expect_resolution="s"),
101101
"attributes": {
102102
"string.attribute": {"string_value": "some string"},
103103
"boolean.attribute": {"bool_value": True},
@@ -112,10 +112,9 @@ def test_ourlog_extraction_with_otel_logs(
112112
},
113113
}
114114

115-
del ourlogs[0]["received"]
116115
del ourlogs[0]["attributes"]["sentry.observed_timestamp_nanos"]
117116

118-
assert ourlogs[0] == expected
117+
assert ourlogs == [expected]
119118

120119
ourlogs_consumer.assert_empty()
121120

@@ -154,13 +153,13 @@ def test_ourlog_extraction_with_sentry_logs(
154153
relay.send_envelope(project_id, envelope)
155154

156155
ourlogs = ourlogs_consumer.get_ourlogs()
157-
assert len(ourlogs) == 1
158156
expected = {
159157
"organization_id": 1,
160158
"project_id": 42,
161159
"retention_days": 90,
162160
"timestamp_nanos": time_within_delta(start, expect_resolution="ns"),
163161
"observed_timestamp_nanos": time_within_delta(start, expect_resolution="ns"),
162+
"received": time_within_delta(start, expect_resolution="s"),
164163
"trace_id": "5b8efff798038103d269b633813fc60c",
165164
"body": "Example log record",
166165
"span_id": "eee19b7ec3c1b174",
@@ -174,9 +173,7 @@ def test_ourlog_extraction_with_sentry_logs(
174173
},
175174
}
176175

177-
del ourlogs[0]["received"]
178-
assert ourlogs[0] == expected
179-
176+
assert ourlogs == [expected]
180177
ourlogs_consumer.assert_empty()
181178

182179

@@ -208,13 +205,13 @@ def test_ourlog_extraction_with_sentry_logs_with_missing_fields(
208205
relay.send_envelope(project_id, envelope)
209206

210207
ourlogs = ourlogs_consumer.get_ourlogs()
211-
assert len(ourlogs) == 1
212208
expected = {
213209
"organization_id": 1,
214210
"project_id": 42,
215211
"retention_days": 90,
216212
"timestamp_nanos": time_within_delta(start, expect_resolution="ns"),
217213
"observed_timestamp_nanos": time_within_delta(start, expect_resolution="ns"),
214+
"received": time_within_delta(start, expect_resolution="s"),
218215
"trace_id": "5b8efff798038103d269b633813fc60c",
219216
"body": "Example log record 2",
220217
"severity_text": "warn",
@@ -224,8 +221,8 @@ def test_ourlog_extraction_with_sentry_logs_with_missing_fields(
224221
"sentry.severity_text": {"string_value": "warn"},
225222
},
226223
}
227-
del ourlogs[0]["received"]
228-
assert ourlogs[0] == expected
224+
assert ourlogs == [expected]
225+
ourlogs_consumer.assert_empty()
229226

230227

231228
def test_ourlog_extraction_is_disabled_without_feature(
@@ -245,6 +242,6 @@ def test_ourlog_extraction_is_disabled_without_feature(
245242
relay.send_envelope(project_id, envelope)
246243

247244
ourlogs = ourlogs_consumer.get_ourlogs()
248-
assert len(ourlogs) == 0
249245

246+
assert len(ourlogs) == 0
250247
ourlogs_consumer.assert_empty()

0 commit comments

Comments
 (0)