terraform: fix some diff comparison
This commit is contained in:
parent
b8ebcc85d7
commit
119d5a09cf
|
@ -2735,7 +2735,6 @@ func TestContext2Apply_emptyModule(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func TestContext2Apply_createBeforeDestroy(t *testing.T) {
|
func TestContext2Apply_createBeforeDestroy(t *testing.T) {
|
||||||
m := testModule(t, "apply-good-create-before")
|
m := testModule(t, "apply-good-create-before")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
|
@ -2789,7 +2788,6 @@ func TestContext2Apply_createBeforeDestroy(t *testing.T) {
|
||||||
t.Fatalf("bad: \n%s", actual)
|
t.Fatalf("bad: \n%s", actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
func TestContext2Apply_minimal(t *testing.T) {
|
func TestContext2Apply_minimal(t *testing.T) {
|
||||||
m := testModule(t, "apply-minimal")
|
m := testModule(t, "apply-minimal")
|
||||||
|
@ -3372,7 +3370,7 @@ func TestContext2Apply_provisionerFail(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func TestContextApply_provisionerFail_createBeforeDestroy(t *testing.T) {
|
func TestContext2Apply_provisionerFail_createBeforeDestroy(t *testing.T) {
|
||||||
m := testModule(t, "apply-provisioner-fail-create-before")
|
m := testModule(t, "apply-provisioner-fail-create-before")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
pr := testProvisioner()
|
pr := testProvisioner()
|
||||||
|
@ -3400,7 +3398,7 @@ func TestContextApply_provisionerFail_createBeforeDestroy(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
ctx := testContext(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Module: m,
|
Module: m,
|
||||||
Providers: map[string]ResourceProviderFactory{
|
Providers: map[string]ResourceProviderFactory{
|
||||||
"aws": testProviderFuncFixed(p),
|
"aws": testProviderFuncFixed(p),
|
||||||
|
@ -3427,6 +3425,7 @@ func TestContextApply_provisionerFail_createBeforeDestroy(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func TestContextApply_error_createBeforeDestroy(t *testing.T) {
|
func TestContextApply_error_createBeforeDestroy(t *testing.T) {
|
||||||
m := testModule(t, "apply-error-create-before")
|
m := testModule(t, "apply-error-create-before")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
|
|
|
@ -30,6 +30,18 @@ func (n *EvalCompareDiff) Eval(
|
||||||
two = new(InstanceDiff)
|
two = new(InstanceDiff)
|
||||||
two.init()
|
two.init()
|
||||||
}
|
}
|
||||||
|
oneId := one.Attributes["id"]
|
||||||
|
twoId := two.Attributes["id"]
|
||||||
|
delete(one.Attributes, "id")
|
||||||
|
delete(two.Attributes, "id")
|
||||||
|
defer func() {
|
||||||
|
if oneId != nil {
|
||||||
|
one.Attributes["id"] = oneId
|
||||||
|
}
|
||||||
|
if twoId != nil {
|
||||||
|
two.Attributes["id"] = twoId
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if !one.Same(two) {
|
if !one.Same(two) {
|
||||||
log.Printf("[ERROR] %s: diff's didn't match", n.Info.Id)
|
log.Printf("[ERROR] %s: diff's didn't match", n.Info.Id)
|
||||||
|
|
|
@ -241,10 +241,11 @@ func (n *graphNodeExpandedResource) EvalTree() EvalNode {
|
||||||
return true, EvalEarlyExitError{}
|
return true, EvalEarlyExitError{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if diffApply.Destroy {
|
if diffApply.Destroy && len(diffApply.Attributes) == 0 {
|
||||||
return true, EvalEarlyExitError{}
|
return true, EvalEarlyExitError{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diffApply.Destroy = false
|
||||||
return true, nil
|
return true, nil
|
||||||
},
|
},
|
||||||
Node: EvalNoop{},
|
Node: EvalNoop{},
|
||||||
|
|
Loading…
Reference in New Issue