github.com/hugorut/terraform@v1.1.3/src/backend/remote-state/manta/client_test.go (about) 1 package manta 2 3 import ( 4 "testing" 5 6 "fmt" 7 "time" 8 9 "github.com/hugorut/terraform/src/backend" 10 "github.com/hugorut/terraform/src/states/remote" 11 ) 12 13 func TestRemoteClient_impl(t *testing.T) { 14 var _ remote.Client = new(RemoteClient) 15 var _ remote.ClientLocker = new(RemoteClient) 16 } 17 18 func TestRemoteClient(t *testing.T) { 19 testACC(t) 20 directory := fmt.Sprintf("terraform-remote-manta-test-%x", time.Now().Unix()) 21 keyName := "testState" 22 23 b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{ 24 "path": directory, 25 "object_name": keyName, 26 })).(*Backend) 27 28 createMantaFolder(t, b.storageClient, directory) 29 defer deleteMantaFolder(t, b.storageClient, directory) 30 31 state, err := b.StateMgr(backend.DefaultStateName) 32 if err != nil { 33 t.Fatal(err) 34 } 35 36 remote.TestClient(t, state.(*remote.State).Client) 37 } 38 39 func TestRemoteClientLocks(t *testing.T) { 40 testACC(t) 41 directory := fmt.Sprintf("terraform-remote-manta-test-%x", time.Now().Unix()) 42 keyName := "testState" 43 44 b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{ 45 "path": directory, 46 "object_name": keyName, 47 })).(*Backend) 48 49 b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{ 50 "path": directory, 51 "object_name": keyName, 52 })).(*Backend) 53 54 createMantaFolder(t, b1.storageClient, directory) 55 defer deleteMantaFolder(t, b1.storageClient, directory) 56 57 s1, err := b1.StateMgr(backend.DefaultStateName) 58 if err != nil { 59 t.Fatal(err) 60 } 61 62 s2, err := b2.StateMgr(backend.DefaultStateName) 63 if err != nil { 64 t.Fatal(err) 65 } 66 67 remote.TestRemoteLocks(t, s1.(*remote.State).Client, s2.(*remote.State).Client) 68 }