You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be really nice if we returned result, err here instead, although that would be a breaking change.
We should at least be able to have an option ExpectFailure and then use that to inform the t.fatal? Although that will need to update the auto API's options.
// Idealup, err:=test.Up()
assert.Error(t, err)
// Also OKup:=test.Up(optup.ExpectFailure())
@VenelinMartinov points out a workaround: up, err := test.CurrentStack().Up(ctx).
The text was updated successfully, but these errors were encountered:
Returning result, err would reduce the clarity of tests as they'd have to now contain error handling for every step. This would be equivilent to just using the AutomationAPI directly without the test framework.
Another option instead of disabling the assert would be to present an alternative method for operations we expect might fail - perhaps something like upResult, err := test.TryUp(). I'm not sure if Try... is a usual convention in Go, perhaps there's another ideom that would do the same job.
danielrbradley
changed the title
Expected failures
Make it easier to handle expected failures
Aug 9, 2024
I have a situation where I expect an update to fail and I'd like to assert that it does. Unfortunately errors are always treated as fatal:
providertest/pulumitest/up.go
Lines 19 to 22 in 385bd7f
It would be really nice if we returned
result, err
here instead, although that would be a breaking change.We should at least be able to have an option
ExpectFailure
and then use that to inform thet.fatal
? Although that will need to update the auto API's options.@VenelinMartinov points out a workaround:
up, err := test.CurrentStack().Up(ctx)
.The text was updated successfully, but these errors were encountered: