Skip to content

Commit

Permalink
ref(feedback): update integration test and doc for #3403 (#3486)
Browse files Browse the repository at this point in the history
Follow-up from #3403.

#skip-changelog  (doc and renaming)
  • Loading branch information
aliu39 committed Apr 26, 2024
1 parent eb2356b commit 6503900
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 83 deletions.
9 changes: 5 additions & 4 deletions relay-dynamic-config/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ pub struct Options {
)]
pub feedback_ingest_topic_rollout_rate: f32,

/// Flag for handling feedback and attachments in the same envelope. Temporary FF for fast-revert
/// (will remove after user feedback GA release).
/// Flag for handling feedback and attachments in the same envelope. This is for the SDK team to send less requests
/// for the user feedback screenshots feature. Prior to this change, feedback sent w/attachments would be produced
/// to the attachments topic, rather than its own topic. The items are now split up accordingly.
///
/// Enabling this will also separate the logic for producing feedback, to its own match case in
/// StoreService::store_envelope
/// This option is used as a temporary FF/kill-switch to toggle back to the old code path in relay's StoreService.
/// This is for testing convenience and will be removed after user feedback's GA release.
#[serde(
rename = "feedback.ingest-inline-attachments",
deserialize_with = "default_on_error",
Expand Down
69 changes: 0 additions & 69 deletions tests/.idea/workspace.xml

This file was deleted.

17 changes: 7 additions & 10 deletions tests/integration/test_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,18 @@ def test_feedback_with_attachment_in_same_envelope(
mini_sentry.add_basic_project_config(
42, extra={"config": {"features": ["organizations:user-feedback-ingest"]}}
)
mini_sentry.set_global_config_option(
"feedback.ingest-topic.rollout-rate", 1.0 if use_feedback_topic else 0.0
)
# Test will only pass with this option set
mini_sentry.set_global_config_option("feedback.ingest-inline-attachments", True)

if use_feedback_topic:
mini_sentry.set_global_config_option("feedback.ingest-topic.rollout-rate", 1.0)
feedback_consumer_ = feedback_consumer(timeout=20)
other_consumer = events_consumer(timeout=20)
feedback_consumer = feedback_consumer(timeout=20)
else:
mini_sentry.set_global_config_option("feedback.ingest-topic.rollout-rate", 0.0)
feedback_consumer_ = events_consumer(timeout=20)
other_consumer = feedback_consumer(timeout=20)
attachments_consumer_ = attachments_consumer(timeout=20)
feedback_consumer = events_consumer(timeout=20)
attachments_consumer = attachments_consumer(timeout=20)

feedback = generate_feedback_sdk_event()
event_id = feedback["event_id"]
Expand Down Expand Up @@ -213,14 +210,14 @@ def test_feedback_with_attachment_in_same_envelope(
# attachment data (relaxed version of test_attachments.py)
received_contents = {} # attachment id -> bytes
while set(received_contents.values()) != {attachment_contents}:
chunk, v = attachments_consumer_.get_attachment_chunk()
chunk, v = attachments_consumer.get_attachment_chunk()
received_contents[v["id"]] = received_contents.get(v["id"], b"") + chunk
assert v["event_id"] == event_id
assert v["project_id"] == project_id
assert len(received_contents) == 1

# attachment headers
attachment_event = attachments_consumer_.get_individual_attachment()
attachment_event = attachments_consumer.get_individual_attachment()
assert attachment_event["event_id"] == event_id
assert attachment_event["project_id"] == project_id
attachment = attachment_event["attachment"]
Expand All @@ -229,7 +226,7 @@ def test_feedback_with_attachment_in_same_envelope(
assert attachment["size"] == attachment_headers["length"]

# feedback event sent to correct topic
event, message = feedback_consumer_.get_event()
event, message = feedback_consumer.get_event()
assert event["type"] == "feedback"

parsed_feedback = json.loads(message["payload"])
Expand All @@ -240,4 +237,4 @@ def test_feedback_with_attachment_in_same_envelope(
other_consumer.assert_empty()

# test message wasn't sent to attachments topic
attachments_consumer_.assert_empty()
attachments_consumer.assert_empty()

0 comments on commit 6503900

Please sign in to comment.