Fix more tests

This commit is contained in:
Fraser Waters 2021-11-18 12:27:22 +00:00
parent 4fa395b03d
commit 9739ff0eed
2 changed files with 4 additions and 2 deletions

View file

@ -3040,7 +3040,7 @@ func TestExpectedUnneededCreate(t *testing.T) {
p.Options.Plan = plan
snap, res = TestOp(Update).Run(project, p.GetTarget(snap), p.Options, false, p.BackendClient, nil)
assert.NotNil(t, snap)
assert.NotNil(t, res)
assert.Nil(t, res)
// Check resA and the provider are still listed in the snapshot
if !assert.Len(t, snap.Resources, 2) {

View file

@ -316,7 +316,9 @@ func (sg *stepGenerator) generateSteps(event RegisterResourceEvent) ([]Step, res
if sg.deployment.plan != nil {
resourcePlan, ok := sg.deployment.plan[urn]
if !ok {
if err := checkMissingPlan(old, inputs, goal); err != nil {
if old == nil {
// We could error here, but we'll trigger an error later on anyway that Create isn't valid here
} else if err := checkMissingPlan(old, inputs, goal); err != nil {
return nil, result.FromError(fmt.Errorf("resource violates plan: %w", err))
}
} else {