Skip to content

Commit 3389c55

Browse files
committed
Skip an unnecessary refresh
1 parent efd3234 commit 3389c55

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

helper/resource/testing_new_config.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,16 @@ func testStepNewConfig(ctx context.Context, t testing.T, c TestCase, wd *plugint
444444

445445
// I'm sorry, I'm afraid I can't do that. With one exception.
446446
if DeprecatedCompatibilityFlagRefreshAfterApply == "unlocked" && !step.Destroy && !step.PlanOnly {
447-
err := runProviderCommandApplyRefreshOnly(ctx, t, wd, providers)
448-
if err != nil {
449-
return fmt.Errorf("Error running apply refresh-only: %w", err)
447+
if len(c.Steps) > stepIndex+1 {
448+
// If the next step is a refresh, then we have no need to refresh here
449+
if !c.Steps[stepIndex+1].RefreshState {
450+
// Echo a searchable message to easily determine when this is no longer being used
451+
fmt.Println("DeprecatedCompatibilityFlagRefreshAfterApply: running apply -refresh-only -refresh=true")
452+
err := runProviderCommandApplyRefreshOnly(ctx, t, wd, providers)
453+
if err != nil {
454+
return fmt.Errorf("Error running apply refresh-only: %w", err)
455+
}
456+
}
450457
}
451458
}
452459

0 commit comments

Comments
 (0)