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 provider examples and integration tests #62

Merged
merged 6 commits into from
Nov 7, 2022
Merged

Conversation

aharter
Copy link
Collaborator

@aharter aharter commented Oct 1, 2022

This adds a similar setup as the wrapped terraform provider.
Bootstraps a unifi controller during test setup and executes the examples.

Closes #39

@aharter aharter requested a review from ringods October 1, 2022 20:02
@aharter aharter marked this pull request as draft October 1, 2022 20:40
@aharter
Copy link
Collaborator Author

aharter commented Oct 1, 2022

I changed the PR into draft. I skips the tests with Skipping: PULUMI_ACCESS_TOKEN is not set

@ringods
Copy link
Member

ringods commented Oct 3, 2022

@aharter can you use local login to keep Pulumi state when running tests?

https://www.pulumi.com/docs/reference/cli/pulumi_login/#options

@aharter aharter force-pushed the provider-tests branch 4 times, most recently from 3f8a208 to 3cc96ce Compare October 4, 2022 20:50
@aharter aharter marked this pull request as ready for review October 4, 2022 20:58
@aharter
Copy link
Collaborator Author

aharter commented Oct 4, 2022

I'm forced to set PULUMI_ACCESS_TOKEN due to this line https://github.com/pulumi/pulumi/blob/ada82e6fd3740628a0a57543ff61209c6d3da0c6/pkg/testing/integration/program.go#L655
Which is weird IMHO (or at least I do not see the immediate requirement to do so). I opted to set it to a bogus value and set PULUMI_API to local file (as opposed to calling pulumi login --local).

@ringods
Copy link
Member

ringods commented Oct 4, 2022

@aharter should I configure this as a bogus Github Actions secret in this repo?

@aharter
Copy link
Collaborator Author

aharter commented Oct 5, 2022

@ringods I prefer to have the value hard wired. Since we also overwrite the "API endpoint" variable it is less confusing.
I guess the integration framework could be extended to only look for the token if non-local endpoint is used.

@ringods
Copy link
Member

ringods commented Oct 5, 2022

@aharter I mentioned this yesterday to some engineering colleagues and they came up with this:

pulumi/pulumi#10921

aharter and others added 6 commits November 7, 2022 10:49
This commit builds on top of the test setup of terraform-provider-unifi.
Running the tests of the terraform provider, I experienced issues like
the controller not being properly setup with a user. By using compose V2
to start the unifi controller and python and urllib for user setup, I
hope to mitigate these issues.
Signed-off-by: Ringo De Smet <ringo@de-smet.name>
@ringods ringods merged commit ccb7bab into main Nov 7, 2022
@ringods ringods deleted the provider-tests branch November 7, 2022 10:18
@joshuaspence
Copy link

FYI I found a simpler method that doesn't require the HTTP bootstrapping: paultyng/terraform-provider-unifi#320

@aharter
Copy link
Collaborator Author

aharter commented Mar 13, 2023

@joshuaspence Thanks for letting us know. I will look into it.

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.

Setup tests for the unifi provider.
3 participants