remove unneeded legacy test
The legacy test wasn't really testing anything useful, just the plan behavior with no diff in a module returned a module with no diff. There's no reason to convert this to the new plans, since there's no legacy behavior to match.
This commit is contained in:
parent
7e0fc55b80
commit
f54113ec08
|
@ -1411,73 +1411,6 @@ func TestContext2Plan_moduleVarComputed(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContext2Plan_nil(t *testing.T) {
|
|
||||||
m := testModule(t, "plan-nil")
|
|
||||||
p := testProvider("aws")
|
|
||||||
p.GetSchemaReturn = &ProviderSchema{
|
|
||||||
ResourceTypes: map[string]*configschema.Block{
|
|
||||||
"aws_instance": {
|
|
||||||
Attributes: map[string]*configschema.Attribute{
|
|
||||||
"nil": {Type: cty.String, Optional: true},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
p.DiffFn = testDiffFn
|
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
|
||||||
Config: m,
|
|
||||||
ProviderResolver: providers.ResolverFixed(
|
|
||||||
map[string]providers.Factory{
|
|
||||||
"aws": testProviderFuncFixed(p),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
State: mustShimLegacyState(&State{
|
|
||||||
Modules: []*ModuleState{
|
|
||||||
&ModuleState{
|
|
||||||
Path: rootModulePath,
|
|
||||||
Resources: map[string]*ResourceState{
|
|
||||||
"aws_instance.foo": &ResourceState{
|
|
||||||
Type: "aws_instance",
|
|
||||||
Primary: &InstanceState{
|
|
||||||
ID: "bar",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
plan, diags := ctx.Plan()
|
|
||||||
if diags.HasErrors() {
|
|
||||||
t.Fatalf("unexpected errors: %s", diags.Err())
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(plan.Changes.Resources) != 1 {
|
|
||||||
t.Fatal("expected 1 changes, got", len(plan.Changes.Resources))
|
|
||||||
}
|
|
||||||
schema := p.GetSchemaReturn.ResourceTypes["aws_instance"]
|
|
||||||
ty := schema.ImpliedType()
|
|
||||||
|
|
||||||
for _, res := range plan.Changes.Resources {
|
|
||||||
if res.Action != plans.Update {
|
|
||||||
t.Fatalf("expected resource creation, got %s", res.Action)
|
|
||||||
}
|
|
||||||
ric, err := res.Decode(ty)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch i := ric.Addr.String(); i {
|
|
||||||
case "aws_instance.foo":
|
|
||||||
checkVals(t, cty.NullVal(schema.ImpliedType()), ric.After)
|
|
||||||
default:
|
|
||||||
t.Fatal("unknown instance:", i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestContext2Plan_preventDestroy_bad(t *testing.T) {
|
func TestContext2Plan_preventDestroy_bad(t *testing.T) {
|
||||||
m := testModule(t, "plan-prevent-destroy-bad")
|
m := testModule(t, "plan-prevent-destroy-bad")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
resource "aws_instance" "foo" {
|
|
||||||
nil = "1"
|
|
||||||
}
|
|
Loading…
Reference in New Issue