Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(workflow_engine): remove remaining references to condition in validators #82438

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

mifu67
Copy link
Contributor

@mifu67 mifu67 commented Dec 19, 2024

Refactor the validator checks for the condition field, which was removed, so that they now validate the type field.

@mifu67 mifu67 requested a review from a team December 19, 2024 23:49
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 19, 2024
Copy link

codecov bot commented Dec 20, 2024

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
23356 3 23353 213
View the top 3 failed tests by shortest run time
tests.sentry.workflow_engine.endpoints.test_validators.MetricAlertComparisonConditionValidatorTest::test_invalid_condition
Stack Traces | 0.134s run time
#x1B[1m#x1B[.../workflow_engine/endpoints/test_validators.py#x1B[0m:156: in test_invalid_condition
    assert validator.errors.get("type") == [
#x1B[1m#x1B[31mE   AssertionError: assert [ErrorDetail(...de='invalid')] == [ErrorDetail(...de='invalid')]#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE     At index 0 diff: ErrorDetail(string='Unsupported type invalid', code='invalid') != ErrorDetail(string='Unsupported condition invalid', code='invalid')#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE     Full diff:#x1B[0m
#x1B[1m#x1B[31mE       [#x1B[0m
#x1B[1m#x1B[31mE     -     ErrorDetail(string='Unsupported condition invalid', code='invalid'),#x1B[0m
#x1B[1m#x1B[31mE     ?                                     ----- ^^^#x1B[0m
#x1B[1m#x1B[31mE     +     ErrorDetail(string='Unsupported type invalid', code='invalid'),#x1B[0m
#x1B[1m#x1B[31mE     ?                                      ^^^#x1B[0m
#x1B[1m#x1B[31mE       ]#x1B[0m
tests.sentry.workflow_engine.endpoints.test_project_detector_index.ProjectDetectorIndexPostTest::test_missing_name
Stack Traces | 2.45s run time
#x1B[1m#x1B[.../workflow_engine/endpoints/test_project_detector_index.py#x1B[0m:187: in test_missing_name
    assert response.data == {"name": ["This field is required."]}
#x1B[1m#x1B[31mE   AssertionError: assert {'name': [Err...required')]}]} == {'name': ['Th...s required.']}#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE     Omitting 1 identical items, use -vv to show#x1B[0m
#x1B[1m#x1B[31mE     Left contains 1 more item:#x1B[0m
#x1B[1m#x1B[31mE     {'dataConditions': [{'type': [ErrorDetail(string='This field is required.', code='required')]}]}#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE     Full diff:#x1B[0m
#x1B[1m#x1B[31mE     + {'name': [ErrorDetail(string='This field is required.', code='required')], 'dataConditions': [{'type': [ErrorDetail(string='This field is required.', code='required')]}]}#x1B[0m
#x1B[1m#x1B[31mE     - {#x1B[0m
#x1B[1m#x1B[31mE     -     'name': [#x1B[0m
#x1B[1m#x1B[31mE     -         'This field is required.',#x1B[0m
#x1B[1m#x1B[31mE     -     ],#x1B[0m
#x1B[1m#x1B[31mE     - }#x1B[0m
tests.sentry.workflow_engine.endpoints.test_project_detector_index.ProjectDetectorIndexPostTest::test_valid_creation
Stack Traces | 2.54s run time
#x1B[1m#x1B[.../workflow_engine/endpoints/test_project_detector_index.py#x1B[0m:116: in test_valid_creation
    response = self.get_success_response(
#x1B[1m#x1B[.../sentry/testutils/cases.py#x1B[0m:686: in get_success_response
    assert_status_code(response, status_code)
#x1B[1m#x1B[.../sentry/testutils/asserts.py#x1B[0m:40: in assert_status_code
    assert minimum <= response.status_code < maximum, (
#x1B[1m#x1B[31mE   AssertionError: (400, b'{"dataConditions":[{"type":["This field is required."]}]}')#x1B[0m
#x1B[1m#x1B[31mE   assert 400 < 202#x1B[0m
#x1B[1m#x1B[31mE    +  where 400 = <Response status_code=400, "application/json">.status_code#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@mifu67 mifu67 marked this pull request as ready for review December 20, 2024 17:31
@mifu67 mifu67 requested a review from a team as a code owner December 20, 2024 17:31
Copy link
Member

@ceorourke ceorourke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks!

@mifu67 mifu67 merged commit 0203fa4 into master Dec 20, 2024
49 checks passed
@mifu67 mifu67 deleted the mifu67/aci/condition-cleanup branch December 20, 2024 18:41
andrewshie-sentry pushed a commit that referenced this pull request Jan 2, 2025
…idators (#82438)

Refactor the validator checks for the `condition` field, which was
removed, so that they now validate the `type` field.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants