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

specgen: re-enable unit tests #217

Merged
merged 9 commits into from
Dec 5, 2024
Merged

Conversation

hariso
Copy link
Contributor

@hariso hariso commented Nov 27, 2024

Description

Closes #214.

Quick checks:

  • I have followed the Code Guidelines.
  • There is no other pull request for the same update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

@hariso hariso changed the base branch from main to specgen November 27, 2024 14:40
@hariso hariso force-pushed the haris/specgen-fix-other-tests branch from ac63a46 to 2c6046d Compare November 28, 2024 12:33
@hariso hariso force-pushed the haris/specgen-fix-other-tests branch from 2c6046d to ec9fe4d Compare November 28, 2024 12:38
@hariso hariso marked this pull request as ready for review November 28, 2024 14:28
@hariso hariso requested a review from a team as a code owner November 28, 2024 14:28
Copy link
Member

@raulb raulb left a comment

Choose a reason for hiding this comment

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

Just a question

@@ -126,7 +126,7 @@ type DestinationWithBatch struct {
// Maximum size of batch before it gets written to the destination.
BatchSize int `json:"sdk.batch.size" default:"0" validate:"gt=-1"`
// Maximum delay before an incomplete batch is written to the destination.
BatchDelay time.Duration `json:"sdk.batch.delay" default:"0" validate:"gt=-1"`
BatchDelay time.Duration `json:"sdk.batch.delay" default:"0"`
Copy link
Member

Choose a reason for hiding this comment

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

Why removing the previous validation?

Copy link
Contributor Author

@hariso hariso Dec 5, 2024

Choose a reason for hiding this comment

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

Because it actually isn't something we support: #54. I guess that Lovro was initially experimenting with it, and found that we don't support gt and lt validations for time.Duration.

@@ -139,6 +139,10 @@ type SourceWithSchemaExtraction struct {
// todo: use https://github.com/ConduitIO/conduit-commons/issues/142 to parse
// the string value into schema.Type directly.
func (c *SourceWithSchemaExtraction) SchemaType() schema.Type {
if c.SchemaTypeStr == "" {
return schema.TypeAvro
Copy link
Member

Choose a reason for hiding this comment

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

(thinking out loud) Could we initialize it with this value when instantiating SourceWithSchemaExtraction?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that would work if we constraint ourselves to always use a constructor method. It's not terrible, but unless we make the type unexported we can't really force anyone to use the constructor method. I believe that in most cases this should be enough, because when the config is parsed using the sdk.Util.ParseConfig function, the default should be set (because we have the default tag).

@hariso hariso merged commit fc5ffee into specgen Dec 5, 2024
3 checks passed
@hariso hariso deleted the haris/specgen-fix-other-tests branch December 5, 2024 15:03
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.

specgen: re-enable unit tests, benchmark tests, etc.
2 participants