pulumi/providertest

providertest: Unable to specify custom ProgramTestOptions

Opened this issue · 0 comments

Issue details

Certain Pulumi Program Tests require setting additional integration.ProgramTestOptions to ensure that the test cases pass, eg. SkipEmptyPreview. Currently, there is no way to specify this on a per test basis when recording snapshots as there isn't a way exposed to pass these options. We should have something similar to pt.RunE2E(...) where the caller can specify ProgramTestOptions overrides (eg: https://github.com/pulumi/providertest/blob/a0511baa20306e11eab1b2a6e224b581c4819647/e2e.go#L24C25-L24C31)

Link to relevant codepath:

providertest/upgrade.go

Lines 658 to 673 in a0511ba

test := integration.ProgramTestOptions{
Dir: b.program,
Env: append(os.Environ(),
// Record gRPC logs.
fmt.Sprintf("PULUMI_DEBUG_GRPC=%s", info.grpcFile),
),
ExportStateValidator: func(t *testing.T, state []byte) {
writeFile(t, info.stateFile, state)
t.Logf("wrote %s", info.stateFile)
},
Config: b.config,
// We could record Refresh for posterity but it is not strictly needed for upgrade
// tests only. It would be needed for tests that try to use snapshots to inform
// import or refresh testing.
SkipRefresh: true,
}