"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "internal/backend/remote-state/oss/backend_test.go" between
terraform-1.0.2.tar.gz and terraform-1.0.3.tar.gz

About: Terraform is a tool for building, changing, and versioning a datacenter infrastructure (written in Go).

backend_test.go  (terraform-1.0.2):backend_test.go  (terraform-1.0.3)
package oss package oss
import ( import (
"fmt" "fmt"
"math/rand"
"os" "os"
"testing" "testing"
"time" "time"
"strings" "strings"
"github.com/aliyun/aliyun-oss-go-sdk/oss" "github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/aliyun/aliyun-tablestore-go-sdk/tablestore" "github.com/aliyun/aliyun-tablestore-go-sdk/tablestore"
"github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/backend"
"github.com/hashicorp/terraform/internal/configs/hcl2shim" "github.com/hashicorp/terraform/internal/configs/hcl2shim"
skipping to change at line 72 skipping to change at line 73
if b.ossClient.Config.AccessKeyID == "" { if b.ossClient.Config.AccessKeyID == "" {
t.Fatalf("No Access Key Id was provided") t.Fatalf("No Access Key Id was provided")
} }
if b.ossClient.Config.AccessKeySecret == "" { if b.ossClient.Config.AccessKeySecret == "" {
t.Fatalf("No Secret Access Key was provided") t.Fatalf("No Secret Access Key was provided")
} }
} }
func TestBackendConfigWorkSpace(t *testing.T) { func TestBackendConfigWorkSpace(t *testing.T) {
testACC(t) testACC(t)
bucketName := fmt.Sprintf("terraform-backend-oss-test-%d", rand.Intn(1000 ))
config := map[string]interface{}{ config := map[string]interface{}{
"region": "cn-beijing", "region": "cn-beijing",
"bucket": "terraform-backend-oss-test", "bucket": bucketName,
"prefix": "mystate", "prefix": "mystate",
"key": "first.tfstate", "key": "first.tfstate",
"tablestore_endpoint": "https://terraformstate.cn-beijing.ots.ali yuncs.com", "tablestore_endpoint": "https://terraformstate.cn-beijing.ots.ali yuncs.com",
"tablestore_table": "TableStore", "tablestore_table": "TableStore",
} }
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(config)). (*Backend) b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(config)). (*Backend)
createOSSBucket(t, b.ossClient, "terraform-backend-oss-test") createOSSBucket(t, b.ossClient, bucketName)
defer deleteOSSBucket(t, b.ossClient, "terraform-backend-oss-test") defer deleteOSSBucket(t, b.ossClient, bucketName)
if _, err := b.Workspaces(); err != nil { if _, err := b.Workspaces(); err != nil {
t.Fatal(err.Error()) t.Fatal(err.Error())
} }
if !strings.HasPrefix(b.ossClient.Config.Endpoint, "https://oss-cn-beijin g") { if !strings.HasPrefix(b.ossClient.Config.Endpoint, "https://oss-cn-beijin g") {
t.Fatalf("Incorrect region was provided") t.Fatalf("Incorrect region was provided")
} }
if b.bucketName != "terraform-backend-oss-test" { if b.bucketName != bucketName {
t.Fatalf("Incorrect bucketName was provided") t.Fatalf("Incorrect bucketName was provided")
} }
if b.statePrefix != "mystate" { if b.statePrefix != "mystate" {
t.Fatalf("Incorrect state file path was provided") t.Fatalf("Incorrect state file path was provided")
} }
if b.stateKey != "first.tfstate" { if b.stateKey != "first.tfstate" {
t.Fatalf("Incorrect keyName was provided") t.Fatalf("Incorrect keyName was provided")
} }
if b.ossClient.Config.AccessKeyID == "" { if b.ossClient.Config.AccessKeyID == "" {
 End of changes. 5 change blocks. 
4 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)