Skip to content

Start serving providers.#45

Merged
paddycarver merged 36 commits intomainfrom
paddy_serve
Jun 24, 2021
Merged

Start serving providers.#45
paddycarver merged 36 commits intomainfrom
paddy_serve

Conversation

@paddycarver
Copy link
Contributor

With all this type work going on, it doesn't mean anything if it's not a gRPC server. So let's wire that up.

@paddycarver paddycarver added the enhancement New feature or request label Jun 8, 2021
@paddycarver paddycarver added this to the v0.1.0 milestone Jun 8, 2021
@paddycarver paddycarver self-assigned this Jun 8, 2021
@paddycarver paddycarver force-pushed the paddy_serve branch 2 times, most recently from 9db2fa0 to 544fa81 Compare June 16, 2021 08:11
@paddycarver paddycarver marked this pull request as ready for review June 16, 2021 08:11
@paddycarver paddycarver requested review from bflad and kmoe June 16, 2021 08:11
@paddycarver
Copy link
Contributor Author

OK, let's address the elephant in the room on this one: testing.

The testing here is abysmal. I added tests for things I thought it made sense to unit test, but a lot of this PR is just integrating previously built units. I really believe that integration tests are probably our best bet here for creating tests that are actually valuable to us.

I think #19 is the right way to address this specific PR, whether that's with terraform-provider-corner or built-in integration tests. My gut says that we probably want to invest in terraform-provider-corner and automate running integration tests separately from the unit tests, but I don't actually know that to be the case.

@kmoe, @bflad, any thoughts, opinions, or feelings on the matter?

Other than tests, I think this is ready for review.

@paddycarver paddycarver force-pushed the paddy_serve branch 2 times, most recently from e7f38c4 to 39c0226 Compare June 23, 2021 19:32
@paddycarver
Copy link
Contributor Author

Weighing in at 6,000 lines of code, I'm finally ready for review, @kmoe @bflad :)

Copy link
Member

@kmoe kmoe left a comment

Choose a reason for hiding this comment

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

This sort of comprehensive testing is the ideal basis for the new framework. Delighted that we can start serving providers - LGTM!


got, err := IsCreate(context.Background(), tc.req, tc.typ)
if err != nil {
if tc.expectedErr == "" {
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't look like expectedErr is used, although I'm happy to leave this in in case the test cases get more complex in future...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sorry, I mostly just wanted to have it so adding tests that provoke errors is easy. I know YAGNI, but tests are one of the places where I like to try and predict future needs, because making adding future cases easy means more comprehensive testing, usually. So when I do table-driven tests, I try to make sure all the non-context.Context arguments can be specified and all the returned values can be checked. (I'm not always perfect at it, but it's a general habit at this point.)

Paddy Carver and others added 19 commits June 24, 2021 08:39
Also, add a nicer error if nil accidentally gets passed to State.Set.
I could've sworn we fixed this in plugin-go, but whatever. Let's be
safe.
Add unit tests covering the internal/proto6 package.
A little less repetition.
Introduce ProviderMeta to ReadResourceRequest, check it's being passed
in the tests.

Split serve tests into multiple files, they're getting impossible to
navigate.

Finish testing read resource for test_one resource, still need to test
it with test_two resource.
Just testing for test_one, with no provider_meta support yet.
Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
Co-authored-by: kmoe <5575356+kmoe@users.noreply.github.com>
@paddycarver paddycarver merged commit e8b9083 into main Jun 24, 2021
@paddycarver paddycarver deleted the paddy_serve branch June 24, 2021 15:54
@paddycarver paddycarver mentioned this pull request Jun 24, 2021
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants