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: add coderd_user resource #18

Merged
merged 5 commits into from
Jul 12, 2024
Merged

feat: add coderd_user resource #18

merged 5 commits into from
Jul 12, 2024

Conversation

deansheather
Copy link
Member

@deansheather deansheather commented Jul 11, 2024

Adds resource "coderd_user"

Relates to #2

Co-authored-by: Ethan Dickson <[email protected]>
@deansheather deansheather requested a review from coadler July 11, 2024 13:25
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package provider
Copy link
Member Author

Choose a reason for hiding this comment

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

This kinda doesn't work because it requires either a mocked client or a real server to connect to. At that point, we might as well go all in on integration tests since they're easier to write.

@@ -50,11 +52,33 @@ func TestIntegration(t *testing.T) {
assertF func(testing.TB, *codersdk.Client)
}{
{
name: "example-test",
name: "user-test",
Copy link
Contributor

Choose a reason for hiding this comment

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

To me, it just seems like these integration tests accomplish the same thing as the acceptance test in user_resource_test.go, yet they're way more complicated. I think the integration tests probably make more sense for chaining resources together or something.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's unclear from your comment what you want to happen. Do you want us to use the integration tests or the resource tests? The resource tests will take effort to get working (most likely some mocking stuff, and we might not be able to use the hashi test framework)

Copy link
Contributor

@coadler coadler Jul 12, 2024

Choose a reason for hiding this comment

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

I feel like you could easily start a coderd pod in the resource tests similar to whats going on here and accomplish the same thing without having to mock anything. It also doesn't seem like we're testing read/update/delete/import here either, which the resource test just has natively. We're also not able to assert any of the terraform state here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, can we do that in a follow up though?

Copy link
Contributor

Choose a reason for hiding this comment

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

shore

Copy link
Member

Choose a reason for hiding this comment

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

If we're going to start a coderd pod for acceptance tests, why not just import coderdtest?

Copy link
Member Author

Choose a reason for hiding this comment

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

There's not much of a difference, but running a container is better because it auto updates for us lol

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah plus we'll need to copy the gomod replaces and keeping that in sync seems like more of a headache

Copy link
Member

Choose a reason for hiding this comment

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

yeah agreed that's super annoying, let's not do that

@ethanndickson ethanndickson merged commit 8c23074 into main Jul 12, 2024
6 of 25 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 12, 2024
@deansheather deansheather deleted the dean/user-resource branch July 26, 2024 07:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants