26 lines
627 B
Go
26 lines
627 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/states/statemgr"
|
|
"github.com/hashicorp/terraform/internal/terminal"
|
|
)
|
|
|
|
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")
|
|
}
|
|
}
|