mirror of https://github.com/databricks/cli.git
added test
This commit is contained in:
parent
7d2d522497
commit
398c4c8df5
|
@ -3,6 +3,7 @@ package terraform
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
|
@ -59,3 +60,23 @@ func TestStatePush(t *testing.T) {
|
|||
diags := bundle.Apply(ctx, b, m)
|
||||
assert.NoError(t, diags.Error())
|
||||
}
|
||||
|
||||
func TestStatePushLargeState(t *testing.T) {
|
||||
mock := mockfiler.NewMockFiler(t)
|
||||
m := &statePush{
|
||||
identityFiler(mock),
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
b := statePushTestBundle(t)
|
||||
|
||||
largeState := map[string]any{}
|
||||
for i := 0; i < 1000000; i++ {
|
||||
largeState[fmt.Sprintf("field_%d", i)] = i
|
||||
}
|
||||
|
||||
// Write a stale local state file.
|
||||
writeLocalState(t, ctx, b, largeState)
|
||||
diags := bundle.Apply(ctx, b, m)
|
||||
assert.ErrorContains(t, diags.Error(), "Terraform state file size exceeds the maximum allowed size of 10485760 bytes. Please reduce the number of resources in your bundle, split your bundle into multiple or re-run the command with --force flag")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue