github.com/opentofu/opentofu@v1.7.1/internal/backend/remote-state/inmem/client_test.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package inmem
     7  
     8  import (
     9  	"testing"
    10  
    11  	"github.com/hashicorp/hcl/v2"
    12  	"github.com/opentofu/opentofu/internal/backend"
    13  	"github.com/opentofu/opentofu/internal/encryption"
    14  	"github.com/opentofu/opentofu/internal/states/remote"
    15  )
    16  
    17  func TestRemoteClient_impl(t *testing.T) {
    18  	var _ remote.Client = new(RemoteClient)
    19  	var _ remote.ClientLocker = new(RemoteClient)
    20  }
    21  
    22  func TestRemoteClient(t *testing.T) {
    23  	defer Reset()
    24  	b := backend.TestBackendConfig(t, New(encryption.StateEncryptionDisabled()), hcl.EmptyBody())
    25  
    26  	s, err := b.StateMgr(backend.DefaultStateName)
    27  	if err != nil {
    28  		t.Fatal(err)
    29  	}
    30  
    31  	remote.TestClient(t, s.(*remote.State).Client)
    32  }
    33  
    34  func TestInmemLocks(t *testing.T) {
    35  	defer Reset()
    36  	s, err := backend.TestBackendConfig(t, New(encryption.StateEncryptionDisabled()), hcl.EmptyBody()).StateMgr(backend.DefaultStateName)
    37  	if err != nil {
    38  		t.Fatal(err)
    39  	}
    40  
    41  	remote.TestRemoteLocks(t, s.(*remote.State).Client, s.(*remote.State).Client)
    42  }