terraform/internal/command/clistate/state_test.go

26 lines
618 B
Go

package clistate
import (
"testing"
"github.com/hashicorp/terraform/internal/command/arguments"
"github.com/hashicorp/terraform/internal/command/views"
"github.com/hashicorp/terraform/internal/terminal"
"github.com/hashicorp/terraform/states/statemgr"
)
func TestUnlock(t *testing.T) {
streams, _ := terminal.StreamsForTesting(t)
view := views.NewView(streams)
l := NewLocker(0, views.NewStateLocker(arguments.ViewHuman, view))
l.Lock(statemgr.NewUnlockErrorFull(nil, nil), "test-lock")
diags := l.Unlock()
if diags.HasErrors() {
t.Log(diags.Err().Error())
} else {
t.Error("expected error")
}
}