remove unneeded testDiffFn and testApplyFn calls
Remove any calls to testDiffFn and testApplyFn which don't effect the test result. This way we have more tests using predictable provider behavior, which is more likely to uncover legitimate regressions as the particular behavior of the legacy mock provider logic does not need to be taken into account.
This commit is contained in:
parent
0a086030b1
commit
e075c8ab8b
File diff suppressed because it is too large
Load Diff
|
@ -17,8 +17,6 @@ import (
|
||||||
func TestContext2Input_provider(t *testing.T) {
|
func TestContext2Input_provider(t *testing.T) {
|
||||||
m := testModule(t, "input-provider")
|
m := testModule(t, "input-provider")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{
|
Provider: &configschema.Block{
|
||||||
Attributes: map[string]*configschema.Attribute{
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
@ -89,8 +87,6 @@ func TestContext2Input_providerMulti(t *testing.T) {
|
||||||
m := testModule(t, "input-provider-multi")
|
m := testModule(t, "input-provider-multi")
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{
|
Provider: &configschema.Block{
|
||||||
Attributes: map[string]*configschema.Attribute{
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
@ -158,8 +154,6 @@ func TestContext2Input_providerMulti(t *testing.T) {
|
||||||
func TestContext2Input_providerOnce(t *testing.T) {
|
func TestContext2Input_providerOnce(t *testing.T) {
|
||||||
m := testModule(t, "input-provider-once")
|
m := testModule(t, "input-provider-once")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -178,8 +172,6 @@ func TestContext2Input_providerId(t *testing.T) {
|
||||||
m := testModule(t, "input-provider")
|
m := testModule(t, "input-provider")
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{
|
Provider: &configschema.Block{
|
||||||
Attributes: map[string]*configschema.Attribute{
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
@ -241,10 +233,7 @@ func TestContext2Input_providerOnly(t *testing.T) {
|
||||||
input := new(MockUIInput)
|
input := new(MockUIInput)
|
||||||
|
|
||||||
m := testModule(t, "input-provider-vars")
|
m := testModule(t, "input-provider-vars")
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{
|
Provider: &configschema.Block{
|
||||||
Attributes: map[string]*configschema.Attribute{
|
Attributes: map[string]*configschema.Attribute{
|
||||||
|
@ -317,8 +306,6 @@ func TestContext2Input_providerVars(t *testing.T) {
|
||||||
input := new(MockUIInput)
|
input := new(MockUIInput)
|
||||||
m := testModule(t, "input-provider-with-vars")
|
m := testModule(t, "input-provider-with-vars")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -363,8 +350,6 @@ func TestContext2Input_providerVarsModuleInherit(t *testing.T) {
|
||||||
input := new(MockUIInput)
|
input := new(MockUIInput)
|
||||||
m := testModule(t, "input-provider-with-vars-and-module")
|
m := testModule(t, "input-provider-with-vars-and-module")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -383,8 +368,6 @@ func TestContext2Input_submoduleTriggersInvalidCount(t *testing.T) {
|
||||||
input := new(MockUIInput)
|
input := new(MockUIInput)
|
||||||
m := testModule(t, "input-submodule-count")
|
m := testModule(t, "input-submodule-count")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
|
|
@ -3830,7 +3830,6 @@ func TestContext2Plan_taintIgnoreChanges(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
|
|
||||||
state := states.NewState()
|
state := states.NewState()
|
||||||
root := state.EnsureModule(addrs.RootModuleInstance)
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
@ -4701,7 +4700,6 @@ func TestContext2Plan_moduleMapLiteral(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {
|
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) (resp providers.PlanResourceChangeResponse) {
|
||||||
s := req.ProposedNewState.AsValueMap()
|
s := req.ProposedNewState.AsValueMap()
|
||||||
m := s["tags"].AsValueMap()
|
m := s["tags"].AsValueMap()
|
||||||
|
@ -4964,7 +4962,6 @@ func TestContext2Plan_createBeforeDestroy_depends_datasource(t *testing.T) {
|
||||||
func TestContext2Plan_listOrder(t *testing.T) {
|
func TestContext2Plan_listOrder(t *testing.T) {
|
||||||
m := testModule(t, "plan-list-order")
|
m := testModule(t, "plan-list-order")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
ResourceTypes: map[string]*configschema.Block{
|
ResourceTypes: map[string]*configschema.Block{
|
||||||
"aws_instance": {
|
"aws_instance": {
|
||||||
|
@ -6101,7 +6098,6 @@ data "test_data_source" "foo" {}
|
||||||
// for_each can reference a resource with 0 instances
|
// for_each can reference a resource with 0 instances
|
||||||
func TestContext2Plan_scaleInForEach(t *testing.T) {
|
func TestContext2Plan_scaleInForEach(t *testing.T) {
|
||||||
p := testProvider("test")
|
p := testProvider("test")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
|
|
||||||
m := testModuleInline(t, map[string]string{
|
m := testModuleInline(t, map[string]string{
|
||||||
"main.tf": `
|
"main.tf": `
|
||||||
|
@ -6237,7 +6233,6 @@ data "test_data_source" "d" {
|
||||||
|
|
||||||
func TestContext2Plan_dataReferencesResource(t *testing.T) {
|
func TestContext2Plan_dataReferencesResource(t *testing.T) {
|
||||||
p := testProvider("test")
|
p := testProvider("test")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
|
|
||||||
p.ReadDataSourceFn = func(req providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse) {
|
p.ReadDataSourceFn = func(req providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse) {
|
||||||
resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("data source should not be read"))
|
resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("data source should not be read"))
|
||||||
|
@ -6285,7 +6280,6 @@ data "test_data_source" "e" {
|
||||||
|
|
||||||
func TestContext2Plan_skipRefresh(t *testing.T) {
|
func TestContext2Plan_skipRefresh(t *testing.T) {
|
||||||
p := testProvider("test")
|
p := testProvider("test")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
p.PlanResourceChangeFn = testDiffFn
|
||||||
|
|
||||||
m := testModuleInline(t, map[string]string{
|
m := testModuleInline(t, map[string]string{
|
||||||
|
@ -6331,7 +6325,6 @@ resource "test_instance" "a" {
|
||||||
|
|
||||||
func TestContext2Plan_dataInModuleDependsOn(t *testing.T) {
|
func TestContext2Plan_dataInModuleDependsOn(t *testing.T) {
|
||||||
p := testProvider("test")
|
p := testProvider("test")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
|
|
||||||
readDataSourceB := false
|
readDataSourceB := false
|
||||||
p.ReadDataSourceFn = func(req providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse) {
|
p.ReadDataSourceFn = func(req providers.ReadDataSourceRequest) (resp providers.ReadDataSourceResponse) {
|
||||||
|
@ -6625,7 +6618,6 @@ resource "test_resource" "foo" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("test")
|
p := testProvider("test")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
|
|
|
@ -48,11 +48,9 @@ func TestContext2Refresh(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: readState,
|
NewState: readState,
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s, diags := ctx.Refresh()
|
s, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -282,7 +280,6 @@ func TestContext2Refresh_targeted(t *testing.T) {
|
||||||
NewState: req.PriorState,
|
NewState: req.PriorState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
_, diags := ctx.Refresh()
|
_, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -361,7 +358,6 @@ func TestContext2Refresh_targetedCount(t *testing.T) {
|
||||||
NewState: req.PriorState,
|
NewState: req.PriorState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
_, diags := ctx.Refresh()
|
_, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -448,7 +444,6 @@ func TestContext2Refresh_targetedCountIndex(t *testing.T) {
|
||||||
NewState: req.PriorState,
|
NewState: req.PriorState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
_, diags := ctx.Refresh()
|
_, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -480,7 +475,6 @@ func TestContext2Refresh_moduleComputedVar(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
m := testModule(t, "refresh-module-computed-var")
|
m := testModule(t, "refresh-module-computed-var")
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
|
@ -513,11 +507,9 @@ func TestContext2Refresh_delete(t *testing.T) {
|
||||||
State: state,
|
State: state,
|
||||||
})
|
})
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: cty.NullVal(p.GetSchemaResponse.ResourceTypes["aws_instance"].Block.ImpliedType()),
|
NewState: cty.NullVal(p.GetSchemaResponse.ResourceTypes["aws_instance"].Block.ImpliedType()),
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s, diags := ctx.Refresh()
|
s, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -541,13 +533,11 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) {
|
||||||
State: nil,
|
State: nil,
|
||||||
})
|
})
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: cty.ObjectVal(map[string]cty.Value{
|
NewState: cty.ObjectVal(map[string]cty.Value{
|
||||||
"id": cty.StringVal("foo"),
|
"id": cty.StringVal("foo"),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
_, diags := ctx.Refresh()
|
_, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -561,7 +551,6 @@ func TestContext2Refresh_ignoreUncreated(t *testing.T) {
|
||||||
func TestContext2Refresh_hook(t *testing.T) {
|
func TestContext2Refresh_hook(t *testing.T) {
|
||||||
h := new(MockHook)
|
h := new(MockHook)
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
m := testModule(t, "refresh-basic")
|
m := testModule(t, "refresh-basic")
|
||||||
|
|
||||||
state := states.NewState()
|
state := states.NewState()
|
||||||
|
@ -623,7 +612,6 @@ func TestContext2Refresh_modules(t *testing.T) {
|
||||||
NewState: new,
|
NewState: new,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s, diags := ctx.Refresh()
|
s, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -640,7 +628,6 @@ func TestContext2Refresh_modules(t *testing.T) {
|
||||||
func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
|
func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
|
||||||
m := testModule(t, "refresh-module-input-computed-output")
|
m := testModule(t, "refresh-module-input-computed-output")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{},
|
Provider: &configschema.Block{},
|
||||||
ResourceTypes: map[string]*configschema.Block{
|
ResourceTypes: map[string]*configschema.Block{
|
||||||
|
@ -675,7 +662,6 @@ func TestContext2Refresh_moduleInputComputedOutput(t *testing.T) {
|
||||||
func TestContext2Refresh_moduleVarModule(t *testing.T) {
|
func TestContext2Refresh_moduleVarModule(t *testing.T) {
|
||||||
m := testModule(t, "refresh-module-var-module")
|
m := testModule(t, "refresh-module-var-module")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -699,13 +685,11 @@ func TestContext2Refresh_noState(t *testing.T) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: cty.ObjectVal(map[string]cty.Value{
|
NewState: cty.ObjectVal(map[string]cty.Value{
|
||||||
"id": cty.StringVal("foo"),
|
"id": cty.StringVal("foo"),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
if _, diags := ctx.Refresh(); diags.HasErrors() {
|
if _, diags := ctx.Refresh(); diags.HasErrors() {
|
||||||
t.Fatalf("refresh errs: %s", diags.Err())
|
t.Fatalf("refresh errs: %s", diags.Err())
|
||||||
|
@ -714,6 +698,7 @@ func TestContext2Refresh_noState(t *testing.T) {
|
||||||
|
|
||||||
func TestContext2Refresh_output(t *testing.T) {
|
func TestContext2Refresh_output(t *testing.T) {
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
|
p.PlanResourceChangeFn = testDiffFn
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{},
|
Provider: &configschema.Block{},
|
||||||
ResourceTypes: map[string]*configschema.Block{
|
ResourceTypes: map[string]*configschema.Block{
|
||||||
|
@ -732,7 +717,6 @@ func TestContext2Refresh_output(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
m := testModule(t, "refresh-output")
|
m := testModule(t, "refresh-output")
|
||||||
|
|
||||||
|
@ -768,7 +752,6 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
|
||||||
// Refresh creates a partial plan for any instances that don't have
|
// Refresh creates a partial plan for any instances that don't have
|
||||||
// remote objects yet, to get stub values for interpolation. Therefore
|
// remote objects yet, to get stub values for interpolation. Therefore
|
||||||
// we need to make DiffFn available to let that complete.
|
// we need to make DiffFn available to let that complete.
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
p.GetSchemaResponse = getSchemaResponseFromProviderSchema(&ProviderSchema{
|
||||||
Provider: &configschema.Block{},
|
Provider: &configschema.Block{},
|
||||||
|
@ -784,7 +767,6 @@ func TestContext2Refresh_outputPartial(t *testing.T) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: cty.NullVal(p.GetSchemaResponse.ResourceTypes["aws_instance"].Block.ImpliedType()),
|
NewState: cty.NullVal(p.GetSchemaResponse.ResourceTypes["aws_instance"].Block.ImpliedType()),
|
||||||
}
|
}
|
||||||
|
@ -839,8 +821,6 @@ func TestContext2Refresh_stateBasic(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: readStateVal,
|
NewState: readStateVal,
|
||||||
}
|
}
|
||||||
|
@ -949,7 +929,6 @@ func TestContext2Refresh_dataState(t *testing.T) {
|
||||||
State: readStateVal,
|
State: readStateVal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s, diags := ctx.Refresh()
|
s, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -1015,7 +994,6 @@ func TestContext2Refresh_dataStateRefData(t *testing.T) {
|
||||||
State: cty.ObjectVal(m),
|
State: cty.ObjectVal(m),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s, diags := ctx.Refresh()
|
s, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -1053,7 +1031,6 @@ func TestContext2Refresh_tainted(t *testing.T) {
|
||||||
NewState: cty.ObjectVal(m),
|
NewState: cty.ObjectVal(m),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s, diags := ctx.Refresh()
|
s, diags := ctx.Refresh()
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
|
@ -1076,9 +1053,6 @@ func TestContext2Refresh_tainted(t *testing.T) {
|
||||||
// Providers was _empty_.
|
// Providers was _empty_.
|
||||||
func TestContext2Refresh_unknownProvider(t *testing.T) {
|
func TestContext2Refresh_unknownProvider(t *testing.T) {
|
||||||
m := testModule(t, "refresh-unknown-provider")
|
m := testModule(t, "refresh-unknown-provider")
|
||||||
p := testProvider("aws")
|
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
state := states.NewState()
|
state := states.NewState()
|
||||||
root := state.EnsureModule(addrs.RootModuleInstance)
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
@ -1140,8 +1114,6 @@ func TestContext2Refresh_vars(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.ReadResourceFn = nil
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
p.ReadResourceResponse = &providers.ReadResourceResponse{
|
||||||
NewState: readStateVal,
|
NewState: readStateVal,
|
||||||
}
|
}
|
||||||
|
@ -1195,7 +1167,6 @@ func TestContext2Refresh_orphanModule(t *testing.T) {
|
||||||
NewState: req.PriorState,
|
NewState: req.PriorState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
state := states.NewState()
|
state := states.NewState()
|
||||||
root := state.EnsureModule(addrs.RootModuleInstance)
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
@ -1265,7 +1236,6 @@ func TestContext2Validate(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
m := testModule(t, "validate-good")
|
m := testModule(t, "validate-good")
|
||||||
c := testContext2(t, &ContextOpts{
|
c := testContext2(t, &ContextOpts{
|
||||||
|
@ -1284,8 +1254,6 @@ func TestContext2Validate(t *testing.T) {
|
||||||
func TestContext2Refresh_updateProviderInState(t *testing.T) {
|
func TestContext2Refresh_updateProviderInState(t *testing.T) {
|
||||||
m := testModule(t, "update-resource-provider")
|
m := testModule(t, "update-resource-provider")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
|
|
||||||
state := states.NewState()
|
state := states.NewState()
|
||||||
root := state.EnsureModule(addrs.RootModuleInstance)
|
root := state.EnsureModule(addrs.RootModuleInstance)
|
||||||
|
@ -1338,7 +1306,6 @@ func TestContext2Refresh_schemaUpgradeFlatmap(t *testing.T) {
|
||||||
"name": cty.StringVal("foo"),
|
"name": cty.StringVal("foo"),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s := states.BuildState(func(s *states.SyncState) {
|
s := states.BuildState(func(s *states.SyncState) {
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -1425,7 +1392,6 @@ func TestContext2Refresh_schemaUpgradeJSON(t *testing.T) {
|
||||||
"name": cty.StringVal("foo"),
|
"name": cty.StringVal("foo"),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
s := states.BuildState(func(s *states.SyncState) {
|
s := states.BuildState(func(s *states.SyncState) {
|
||||||
s.SetResourceInstanceCurrent(
|
s.SetResourceInstanceCurrent(
|
||||||
|
@ -1503,7 +1469,6 @@ data "aws_data_source" "foo" {
|
||||||
resp.State = req.Config
|
resp.State = req.Config
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
|
@ -1544,7 +1509,6 @@ func TestContext2Refresh_dataResourceDependsOn(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.ReadDataSourceResponse = &providers.ReadDataSourceResponse{
|
p.ReadDataSourceResponse = &providers.ReadDataSourceResponse{
|
||||||
State: cty.ObjectVal(map[string]cty.Value{
|
State: cty.ObjectVal(map[string]cty.Value{
|
||||||
"compute": cty.StringVal("value"),
|
"compute": cty.StringVal("value"),
|
||||||
|
@ -1653,8 +1617,6 @@ resource "aws_instance" "foo" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
|
@ -1722,8 +1684,6 @@ resource "aws_instance" "bar" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
|
|
|
@ -1024,8 +1024,6 @@ func TestContext2Validate_targetedDestroy(t *testing.T) {
|
||||||
m := testModule(t, "validate-targeted")
|
m := testModule(t, "validate-targeted")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
pr := simpleMockProvisioner()
|
pr := simpleMockProvisioner()
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = &providers.GetSchemaResponse{
|
p.GetSchemaResponse = &providers.GetSchemaResponse{
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
"aws_instance": {
|
"aws_instance": {
|
||||||
|
@ -1117,8 +1115,6 @@ func TestContext2Validate_interpolateVar(t *testing.T) {
|
||||||
|
|
||||||
m := testModule(t, "input-interpolate-var")
|
m := testModule(t, "input-interpolate-var")
|
||||||
p := testProvider("null")
|
p := testProvider("null")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = &providers.GetSchemaResponse{
|
p.GetSchemaResponse = &providers.GetSchemaResponse{
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
"template_file": {
|
"template_file": {
|
||||||
|
@ -1152,8 +1148,6 @@ func TestContext2Validate_interpolateComputedModuleVarDef(t *testing.T) {
|
||||||
|
|
||||||
m := testModule(t, "validate-computed-module-var-ref")
|
m := testModule(t, "validate-computed-module-var-ref")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
p.GetSchemaResponse = &providers.GetSchemaResponse{
|
p.GetSchemaResponse = &providers.GetSchemaResponse{
|
||||||
ResourceTypes: map[string]providers.Schema{
|
ResourceTypes: map[string]providers.Schema{
|
||||||
"aws_instance": {
|
"aws_instance": {
|
||||||
|
@ -1186,8 +1180,6 @@ func TestContext2Validate_interpolateMap(t *testing.T) {
|
||||||
|
|
||||||
m := testModule(t, "issue-9549")
|
m := testModule(t, "issue-9549")
|
||||||
p := testProvider("template")
|
p := testProvider("template")
|
||||||
p.ApplyResourceChangeFn = testApplyFn
|
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
|
@ -1691,7 +1683,6 @@ resource "aws_instance" "foo" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -1720,7 +1711,6 @@ resource "aws_instance" "foo" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -1752,7 +1742,6 @@ resource "aws_instance" "foo" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
@ -1835,7 +1824,6 @@ output "out" {
|
||||||
})
|
})
|
||||||
|
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
p.PlanResourceChangeFn = testDiffFn
|
|
||||||
ctx := testContext2(t, &ContextOpts{
|
ctx := testContext2(t, &ContextOpts{
|
||||||
Config: m,
|
Config: m,
|
||||||
Providers: map[addrs.Provider]providers.Factory{
|
Providers: map[addrs.Provider]providers.Factory{
|
||||||
|
|
|
@ -248,10 +248,10 @@ func (h *HookRecordApplyOrder) PreApply(addr addrs.AbsResourceInstance, gen stat
|
||||||
|
|
||||||
const testTerraformInputProviderOnlyStr = `
|
const testTerraformInputProviderOnlyStr = `
|
||||||
aws_instance.foo:
|
aws_instance.foo:
|
||||||
ID = foo
|
ID =
|
||||||
provider = provider["registry.terraform.io/hashicorp/aws"]
|
provider = provider["registry.terraform.io/hashicorp/aws"]
|
||||||
foo = us-west-2
|
foo = us-west-2
|
||||||
type = aws_instance
|
type =
|
||||||
`
|
`
|
||||||
|
|
||||||
const testTerraformApplyStr = `
|
const testTerraformApplyStr = `
|
||||||
|
|
Loading…
Reference in New Issue