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

feat: alternative way to bootstrap the tests #263

Merged
merged 3 commits into from
Oct 9, 2024
Merged

Conversation

thall
Copy link
Member

@thall thall commented Oct 4, 2024

TL;DR

With this setup you need to explicit opt-out tests instead of explicit opt-int.

Why

We have noticed historically, that when people adds new
resources, it's easy to forget to implement the newly
generated AIP tests, either directly or later.

How

This commit tries to solve that issue by introducing a
main entrypoint to execute the tests, which takes a interface
that the user needs to implement.

When a new resource is added, the interface will be extended with
another method that the user needs to implement, if not, a compilation
error would be raised.

The user can choose to return nil to indicate that it can't be
implemented right directly.

All tests will still be executed, but if not implemented it will be
skipped, this to show it's available but not implemented.

This commit is backwards compatible with the current test setup.

For example usage, see examples/.

@thall thall changed the title new test setup feat: alternative way to bootstrap the tests Oct 4, 2024
@thall thall marked this pull request as ready for review October 4, 2024 07:16
@thall thall requested a review from a team as a code owner October 4, 2024 07:16
@thall thall requested review from ericwenn and removed request for a team October 4, 2024 07:16
Copy link
Member

@fredrikaverpil fredrikaverpil left a comment

Choose a reason for hiding this comment

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

I'm not sure where this is headed, but it LGTM technically.

Ping us if you want to show where you are going with this 😄

EDIT: never mind! I'm tired... somehow I missed the last commit, which contains all the goodies.

@fredrikaverpil fredrikaverpil self-requested a review October 4, 2024 09:28
Copy link
Member

@fredrikaverpil fredrikaverpil left a comment

Choose a reason for hiding this comment

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

I thought it was enough to hit re-review to retract the approval ... but no.

Copy link
Member

@radhus radhus left a comment

Choose a reason for hiding this comment

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

Nice to have an alternative interface! This is non-breaking (except users will get changes in their generated code, expected), so I think we should try it out!

Copy link
Member

@ericwenn ericwenn left a comment

Choose a reason for hiding this comment

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

I like this!
Address the comment and example comments, and I think this is safe enough to try. I really like that it is not a breaking change for users (except that more code is generated) ⭐

thall added 3 commits October 9, 2024 11:43
This commit replaces the `ctx` field on the config struct,
with a function for getting a context.
Same context is used as before, this is preparation for
upcomming commits.
This commit replaces the `service` field on the config struct,
with a function for getting the service to be tested.
This is a preparation for upcomming commit.
We have noticed historically, that when people adds new
resources, it's easy to forget to implement the newly
generated AIP tests, either directly or later.

This commit tries to solve that issue by introducing a
main entrypoint to execute the tests, which takes a interface
that the user needs to implement.

When a new resource is added, the interface will be extended with
another method that the user needs to implement, if not, a compilation
error would be raised.

The user can choose to return `nil` to indicate that it can't be
implemented right directly.

All tests will still be executed, but if not implemented it will be
skipped, this to show it's available but not implemented.

This commit is backwards compatible with the current test setup.

For example usage, see `examples/`.
@thall thall merged commit f9ff1a1 into master Oct 9, 2024
1 check passed
@thall thall deleted the new-test-setup branch October 9, 2024 09:46
@fredrikaverpil
Copy link
Member

fredrikaverpil commented Oct 11, 2024

@thall late to the party, but I was just wondering if you wanted to also add a note to the main README about this new type of setup?

@thall
Copy link
Member Author

thall commented Oct 11, 2024

@fredrikaverpil yes, I will update the README as well, thanks for the reminder!

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.

4 participants