core: Tests for scale in and out need to mock EvalExpression
Since expression evaluation is now done via an EvalContext method, and since these tests use the MockEvalContext, we need to provide a value for the mock call to return. Previously expression evaluation happened at a different layer that was not mocked here.
This commit is contained in:
parent
bec0f56808
commit
168354c2e8
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/addrs"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
)
|
||||
|
||||
func TestNodeRefreshableDataResourceDynamicExpand_scaleOut(t *testing.T) {
|
||||
|
@ -53,6 +54,11 @@ func TestNodeRefreshableDataResourceDynamicExpand_scaleOut(t *testing.T) {
|
|||
PathPath: addrs.RootModuleInstance,
|
||||
StateState: state,
|
||||
StateLock: &stateLock,
|
||||
|
||||
// DynamicExpand will call EvaluateExpr to evaluate the "count"
|
||||
// expression, which is just a literal number 3 in the fixture config
|
||||
// and so we'll just hard-code this here too.
|
||||
EvaluateExprResult: cty.NumberIntVal(3),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("error on DynamicExpand: %s", err)
|
||||
|
@ -134,6 +140,11 @@ func TestNodeRefreshableDataResourceDynamicExpand_scaleIn(t *testing.T) {
|
|||
PathPath: addrs.RootModuleInstance,
|
||||
StateState: state,
|
||||
StateLock: &stateLock,
|
||||
|
||||
// DynamicExpand will call EvaluateExpr to evaluate the "count"
|
||||
// expression, which is just a literal number 3 in the fixture config
|
||||
// and so we'll just hard-code this here too.
|
||||
EvaluateExprResult: cty.NumberIntVal(3),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("error on DynamicExpand: %s", err)
|
||||
|
|
|
@ -5,6 +5,8 @@ import (
|
|||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
|
||||
"github.com/hashicorp/terraform/addrs"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
@ -54,6 +56,11 @@ func TestNodeRefreshableManagedResourceDynamicExpand_scaleOut(t *testing.T) {
|
|||
PathPath: addrs.RootModuleInstance,
|
||||
StateState: state,
|
||||
StateLock: &stateLock,
|
||||
|
||||
// DynamicExpand will call EvaluateExpr to evaluate the "count"
|
||||
// expression, which is just a literal number 3 in the fixture config
|
||||
// and so we'll just hard-code this here too.
|
||||
EvaluateExprResult: cty.NumberIntVal(3),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("error attempting DynamicExpand: %s", err)
|
||||
|
@ -133,6 +140,11 @@ func TestNodeRefreshableManagedResourceDynamicExpand_scaleIn(t *testing.T) {
|
|||
PathPath: addrs.RootModuleInstance,
|
||||
StateState: state,
|
||||
StateLock: &stateLock,
|
||||
|
||||
// DynamicExpand will call EvaluateExpr to evaluate the "count"
|
||||
// expression, which is just a literal number 3 in the fixture config
|
||||
// and so we'll just hard-code this here too.
|
||||
EvaluateExprResult: cty.NumberIntVal(3),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("error attempting DynamicExpand: %s", err)
|
||||
|
|
Loading…
Reference in New Issue