|
|
|
|
@ -6573,33 +6573,15 @@ func TestPlanWithDeferredActionInvocation(t *testing.T) {
|
|
|
|
|
return plannedChangeSortKey(gotChanges[i]) < plannedChangeSortKey(gotChanges[j])
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// First, let's verify the resource was actually deferred
|
|
|
|
|
var foundDeferredResource bool
|
|
|
|
|
var foundNormalActionInvocation bool
|
|
|
|
|
// Find the deferred action invocation in the changes
|
|
|
|
|
var foundDeferredAction bool
|
|
|
|
|
|
|
|
|
|
for _, change := range gotChanges {
|
|
|
|
|
switch c := change.(type) {
|
|
|
|
|
case *stackplan.PlannedChangeDeferredResourceInstancePlanned:
|
|
|
|
|
foundDeferredResource = true
|
|
|
|
|
t.Logf("Found deferred resource: %s", c.ResourceInstancePlanned.ResourceInstanceObjectAddr)
|
|
|
|
|
case *stackplan.PlannedChangeActionInvocationInstancePlanned:
|
|
|
|
|
foundNormalActionInvocation = true
|
|
|
|
|
t.Logf("Found normal action invocation: %s", c.ActionInvocationAddr)
|
|
|
|
|
case *stackplan.PlannedChangeDeferredActionInvocation:
|
|
|
|
|
if _, ok := change.(*stackplan.PlannedChangeDeferredActionInvocation); ok {
|
|
|
|
|
foundDeferredAction = true
|
|
|
|
|
t.Logf("Found deferred action invocation: %s", c.ActionInvocationPlanned.ActionInvocationAddr)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !foundDeferredResource {
|
|
|
|
|
t.Error("Expected to find a deferred resource, but none was found")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if foundNormalActionInvocation {
|
|
|
|
|
t.Error("Action invocation should be deferred, not appearing as a normal invocation")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !foundDeferredAction {
|
|
|
|
|
t.Error("Expected to find a deferred action invocation in the plan changes, but none was found")
|
|
|
|
|
t.Logf("Got %d changes:", len(gotChanges))
|
|
|
|
|
|