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

Add team resource #139

Merged
merged 3 commits into from
Sep 1, 2021
Merged

Add team resource #139

merged 3 commits into from
Sep 1, 2021

Conversation

RLRabinowitz
Copy link
Contributor

Issue & Steps to Reproduce / Feature Request

Feature Request: Support team resource

Solution

Support team resource with two attributes: name and description.
Add tests

@RLRabinowitz RLRabinowitz requested a review from a team August 31, 2021 15:57
@RLRabinowitz RLRabinowitz self-assigned this Aug 31, 2021
Copy link
Member

@eranelbaz eranelbaz left a comment

Choose a reason for hiding this comment

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

what about tests for multiple teams with the same name?
api returns nothing for the id?
all the errors we should add t.Run for them


func resourceTeamImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
id := d.Id()
var getErr diag.Diagnostics
Copy link
Member

Choose a reason for hiding this comment

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

why you need this instead of returning nil, err?
i mean if uuidErr is nil then we don't need to make another if why not just return? same for the else

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 don't understand what you mean. 🤙🏻

@RLRabinowitz
Copy link
Contributor Author

what about tests for multiple teams with the same name?

You mean in import? We currently don't have tests for imports (doesn't seem like the current framework supports it)

api returns nothing for the id?

This is something we never addressed in our code. We could throw an error in such a case. Not sure it's that important though

all the errors we should add t.Run for them

The thing is that the tests aren't really unit tests. So testing those isn't nice (you need to mock exact amount of previous calls)

@eranelbaz
Copy link
Member

@RLRabinowitz

I mean you are throwing errors such as could not update team: so lets assert we get them when the relevant error accour,
those are stuff we do look at template resource, configuration variable resource cloud credentials project assignment and more

The thing is that the tests aren't really unit tests. So testing those isn't nice (you need to mock exact amount of previous calls)

I pretty sure we do that, we have stuff like gomock.InOrder to handle those

@RLRabinowitz
Copy link
Contributor Author

@eranelbaz I know we do that sometimes. I'm just not sure it's worth the effort

@RLRabinowitz
Copy link
Contributor Author

Added tests for all but delete, because it's impossible with the flow (the error is outside of a step).
That just shows how bad this framework is for unit tests

Copy link
Member

@eranelbaz eranelbaz left a comment

Choose a reason for hiding this comment

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

@RLRabinowitz RLRabinowitz merged commit f5cf1e9 into main Sep 1, 2021
@RLRabinowitz RLRabinowitz deleted the feat-add-team-resource branch September 1, 2021 15:43
@RLRabinowitz
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants