2017-04-22 22:42:37 +02:00
|
|
|
package swift
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2021-05-17 17:42:17 +02:00
|
|
|
"github.com/hashicorp/terraform/internal/backend"
|
2021-05-17 21:43:35 +02:00
|
|
|
"github.com/hashicorp/terraform/internal/states/remote"
|
2017-04-22 22:42:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestRemoteClient_impl(t *testing.T) {
|
|
|
|
var _ remote.Client = new(RemoteClient)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRemoteClient(t *testing.T) {
|
|
|
|
testACC(t)
|
|
|
|
|
2018-06-25 09:23:14 +02:00
|
|
|
container := fmt.Sprintf("terraform-state-swift-testclient-%x", time.Now().Unix())
|
2017-04-22 22:42:37 +02:00
|
|
|
|
2018-03-21 02:43:02 +01:00
|
|
|
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
2017-04-22 22:42:37 +02:00
|
|
|
"container": container,
|
2018-03-21 02:43:02 +01:00
|
|
|
})).(*Backend)
|
2017-04-22 22:42:37 +02:00
|
|
|
|
2018-10-01 23:35:23 +02:00
|
|
|
state, err := b.StateMgr(backend.DefaultStateName)
|
2017-04-22 22:42:37 +02:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2018-06-25 09:23:14 +02:00
|
|
|
client := &RemoteClient{
|
|
|
|
client: b.client,
|
|
|
|
container: b.container,
|
|
|
|
}
|
|
|
|
|
|
|
|
defer client.deleteContainer()
|
2017-04-22 22:42:37 +02:00
|
|
|
|
|
|
|
remote.TestClient(t, state.(*remote.State).Client)
|
|
|
|
}
|