Test expected delete
This commit is contained in:
parent
505e4c5d06
commit
d995901fa7
|
@ -97,8 +97,15 @@ func (rp *ResourcePlan) diffPropertyDependencies(a, b map[resource.PropertyKey][
|
|||
}
|
||||
|
||||
func (rp *ResourcePlan) checkGoal(programGoal *resource.Goal) error {
|
||||
contract.Assert(rp.Goal.Type == programGoal.Type)
|
||||
contract.Assert(rp.Goal.Name == programGoal.Name)
|
||||
contract.Assert(programGoal != nil)
|
||||
// rp.Goal may be nil, but if it isn't Type and Name should match
|
||||
contract.Assert(rp.Goal == nil || rp.Goal.Type == programGoal.Type)
|
||||
contract.Assert(rp.Goal == nil || rp.Goal.Name == programGoal.Name)
|
||||
|
||||
if rp.Goal == nil {
|
||||
// If the plan goal is nil it expected a delete
|
||||
return fmt.Errorf("resource unexpectedly not deleted")
|
||||
}
|
||||
|
||||
// Check that either both resources are custom resources or both are component resources.
|
||||
if programGoal.Custom != rp.Goal.Custom {
|
||||
|
|
|
@ -241,7 +241,7 @@ func (sg *stepGenerator) generateSteps(event RegisterResourceEvent) ([]Step, res
|
|||
sg.urns[urn] = true
|
||||
|
||||
// If there is a plan for this resource, validate that the program goal conforms to the plan.
|
||||
if len(sg.deployment.plan) != 0 {
|
||||
if sg.deployment.plan != nil {
|
||||
resourcePlan, ok := sg.deployment.plan[urn]
|
||||
if !ok {
|
||||
return nil, result.Errorf("resource not found in plan")
|
||||
|
|
Loading…
Reference in a new issue