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

tests,schema_reader: kafka message handling error tests #941

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

nosahama
Copy link
Contributor

@nosahama nosahama commented Aug 29, 2024

About this change - What it does

We add tests to validate the possible error cases while parsing the message key:

  • we test for invalid JSON for key
  • missing keytype in the key data
  • we test for invalid keytype
  • we test for invalid config value
  • we test for invalid subject delete value
  • we test for invalid version number within schema value
  • we test for generic invalid protobuf schema

Why this way

This is not added via the integration tests as we are verifying the side-effects which are then handled by other components and thus the unit tests are fine just to add.

The work requires the work currently done in #936 and thus was tested locally with a rebase on that branch, some linting and added tests might fail until we merge the other PR.

@nosahama nosahama requested review from a team as code owners August 29, 2024 12:43
@nosahama nosahama force-pushed the nosahama/avro-message-handling-error-tests branch from e7ee2fa to c5c7260 Compare August 29, 2024 12:45
@davide-armand
Copy link
Contributor

Should the base branch of this PR be #936 's branch , since it depends on it?

@nosahama
Copy link
Contributor Author

Should the base branch of this PR be #936 's branch , since it depends on it?

Yes I totally get your point, I had already started off that work and thus the rebase, ideally when this is merged to main, the commits will be the ideal count.

@nosahama nosahama force-pushed the nosahama/avro-message-handling-error-tests branch 3 times, most recently from 2b793ce to 1b50a1f Compare September 5, 2024 16:35
Copy link
Contributor

@eliax1996 eliax1996 left a comment

Choose a reason for hiding this comment

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

Excellent! Other than that I think its fine!

karapace/schema_reader.py Outdated Show resolved Hide resolved
@Claudenw
Copy link

Claudenw commented Sep 6, 2024 via email

@nosahama
Copy link
Contributor Author

nosahama commented Sep 6, 2024

Do we not log all messages associated with Errors? If not, should we? Also nit: "doesnt" should be "doesn't" or "does not" which I think is clearer. Claude

On Fri, Sep 6, 2024 at 10:59 AM Emmanuel Evbuomwan @.> wrote: @.* commented on this pull request. ------------------------------ In karapace/schema_reader.py <#941 (comment)>: > @@ -487,7 +487,7 @@ def _handle_msg_config(self, key: dict, value: dict | None) -> None: def _handle_msg_delete_subject(self, key: dict, value: dict | None) -> None: # pylint: disable=unused-argument if value is None: LOG.warning("DELETE_SUBJECT record doesnt have a value, should have") - return + raise ValueError("DELETE_SUBJECT record doesnt have a value, should have") Yes I agree, i tried not to change most of these. — Reply to this email directly, view it on GitHub <#941 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASTVHQKBPQOWZWRUKOHUS3ZVF4INAVCNFSM6AAAAABNKLES2GVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEOBVG43DKMBUGM . You are receiving this because your review was requested.Message ID: @.***>
-- LinkedIn: http://www.linkedin.com/in/claudewarren

Yes indeed, we should log all errors, we can check which ones we do not currently log and log those as a follow up task, as for the typo, I was trying my best not to change much of what already exists.

@nosahama nosahama force-pushed the nosahama/avro-message-handling-error-tests branch from 1b50a1f to 9831693 Compare September 6, 2024 12:36
…tests

We add tests to validate the possible error cases while parsing the message key:
- we test for invalid JSON for key
- missing `keytype` in the key data
- we test for invalid `keytype`
- we test for invalid config value
- we test for invalid subject delete value
- we test for invalid version number within schema value
- we test for generic invalid protobuf schema
@nosahama nosahama force-pushed the nosahama/avro-message-handling-error-tests branch from 9831693 to e3899bd Compare September 9, 2024 12:16
Copy link
Contributor

@eliax1996 eliax1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@eliax1996 eliax1996 merged commit 661a7a4 into main Sep 13, 2024
9 of 10 checks passed
@eliax1996 eliax1996 deleted the nosahama/avro-message-handling-error-tests branch September 13, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants