Skip to content

Commit

Permalink
make create_event conditionally use both helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterkatie committed Oct 17, 2024
1 parent c740024 commit 2fc4061
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions tests/sentry/grouping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ def _save_event_with_pipeline(
):
return save_new_event(self.data, project)

def create_event(self, config_name: str) -> Event:
def create_event(
self,
config_name: str,
use_full_ingest_pipeline: bool = True,
project: Project | None = None,
) -> Event:
grouping_config = get_default_grouping_config_dict(config_name)

# Add in any extra grouping configuration from the input data
Expand All @@ -86,7 +91,11 @@ def create_event(self, config_name: str) -> Event:
bases=CONFIGURATIONS[config_name].fingerprinting_bases,
)

event = self._manually_save_event(grouping_config, fingerprinting_config)
if use_full_ingest_pipeline:
assert project, "'project' is required to use full pipeline"
event = self._save_event_with_pipeline(grouping_config, fingerprinting_config, project)
else:
event = self._manually_save_event(grouping_config, fingerprinting_config)

return event

Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/grouping/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setup():


def run_configuration(grouping_input: GroupingInput, config_name: str) -> None:
event = grouping_input.create_event(config_name)
event = grouping_input.create_event(config_name, use_full_ingest_pipeline=False)

# This ensures we won't try to touch the DB when getting event hashes
event.project = None # type: ignore[assignment]
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/grouping/test_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _dump_component(component: GroupingComponent, indent: int) -> None:
def test_event_hash_variant(
config_name: str, grouping_input: GroupingInput, insta_snapshot: InstaSnapshotter
) -> None:
event = grouping_input.create_event(config_name)
event = grouping_input.create_event(config_name, use_full_ingest_pipeline=False)

# This ensures we won't try to touch the DB when getting event variants
event.project = None # type: ignore[assignment]
Expand Down

0 comments on commit 2fc4061

Please sign in to comment.