2017-02-18 02:26:38 +01:00
|
|
|
package inmem
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-09-10 00:58:44 +02:00
|
|
|
"github.com/hashicorp/hcl/v2"
|
2021-05-17 17:42:17 +02:00
|
|
|
"github.com/hashicorp/terraform/internal/backend"
|
2020-08-11 17:43:01 +02:00
|
|
|
"github.com/hashicorp/terraform/states/remote"
|
2017-02-18 02:26:38 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestRemoteClient_impl(t *testing.T) {
|
|
|
|
var _ remote.Client = new(RemoteClient)
|
|
|
|
var _ remote.ClientLocker = new(RemoteClient)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRemoteClient(t *testing.T) {
|
2017-08-01 22:15:52 +02:00
|
|
|
defer Reset()
|
2018-03-21 02:43:02 +01:00
|
|
|
b := backend.TestBackendConfig(t, New(), hcl.EmptyBody())
|
2017-08-01 18:11:04 +02:00
|
|
|
|
2018-10-01 23:35:23 +02:00
|
|
|
s, err := b.StateMgr(backend.DefaultStateName)
|
2017-08-01 18:11:04 +02:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
remote.TestClient(t, s.(*remote.State).Client)
|
2017-02-18 02:26:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestInmemLocks(t *testing.T) {
|
2017-08-01 22:15:52 +02:00
|
|
|
defer Reset()
|
2018-10-01 23:35:23 +02:00
|
|
|
s, err := backend.TestBackendConfig(t, New(), hcl.EmptyBody()).StateMgr(backend.DefaultStateName)
|
2017-02-18 02:26:38 +01:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
remote.TestRemoteLocks(t, s.(*remote.State).Client, s.(*remote.State).Client)
|
|
|
|
}
|