pulumi / providertest

Incubating facilities for testing Pulumi providers
Apache License 2.0
5 stars 0 forks source link

Launch providers into workspace directory #69

Closed EronWright closed 8 months ago

EronWright commented 8 months ago

Closes #65

Breaking changes:

codecov[bot] commented 8 months ago

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 37.27%. Comparing base (8c45fd2) to head (dd332f3). Report is 15 commits behind head on main.

Files Patch % Lines
providers/localBinary.go 50.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #69 +/- ## ========================================== + Coverage 33.45% 37.27% +3.82% ========================================== Files 42 42 Lines 2571 2664 +93 ========================================== + Hits 860 993 +133 + Misses 1606 1565 -41 - Partials 105 106 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

EronWright commented 8 months ago

@danielrbradley I would argue that functional options are counter-productive in this case, because the ProviderFactory isn't a user-facing API, and that implementing a factory would be more difficult. Functional options are routinely converted to an options representation for further processing; why make each factory do this? ProviderOptions can be understood as the already-converted representation.

If you're still wanting it, let me know and I'll give it a try. Thanks!

danielrbradley commented 8 months ago

Ok, been mulling this over a little more. Passing an argument for WorkDir to the provider assumes that the factory has to honnor it, but some implementations may well not use it. Therefore one subtle change would be to not pass in options but pass in some context about the program under test. This could be a simple interface with just a Source() method for now but could be added to if needed. This interface would already be implemented by the PulumiTest struct. E.g.

type PulumiTest interface {
    Source() string
}