Fixing a flapping AzureRM PublicIP validation test

This commit is contained in:
stack72 2016-01-21 20:59:30 +00:00
parent a83d1bab23
commit eb6fd87a42
1 changed files with 2 additions and 13 deletions

View File

@ -2,11 +2,10 @@ package azurerm
import ( import (
"fmt" "fmt"
"math/rand"
"net/http" "net/http"
"testing" "testing"
"time"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
@ -65,7 +64,7 @@ func TestResourceAzureRMPublicIpDomainNameLabel_validation(t *testing.T) {
ErrCount: 1, ErrCount: 1,
}, },
{ {
Value: randomString(80), Value: acctest.RandString(80),
ErrCount: 1, ErrCount: 1,
}, },
} }
@ -227,16 +226,6 @@ func testCheckAzureRMPublicIpDestroy(s *terraform.State) error {
return nil return nil
} }
func randomString(strlen int) string {
rand.Seed(time.Now().UTC().UnixNano())
const chars = "abcdefghijklmnopqrstuvwxyz0123456789-"
result := make([]byte, strlen)
for i := 0; i < strlen; i++ {
result[i] = chars[rand.Intn(len(chars))]
}
return string(result)
}
var testAccAzureRMVPublicIpStatic_basic = ` var testAccAzureRMVPublicIpStatic_basic = `
resource "azurerm_resource_group" "test" { resource "azurerm_resource_group" "test" {
name = "acceptanceTestResourceGroup1" name = "acceptanceTestResourceGroup1"