<commit_before>package azurerm

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/hashicorp/terraform/helper/acctest"
	"github.com/hashicorp/terraform/helper/resource"
	"github.com/hashicorp/terraform/terraform"
)

func TestAccAzureRMCosmosDBAccountName_validation(t *testing.T) {
	str := acctest.RandString(50)
	cases := []struct {
		Value    string
		ErrCount int
	}{
		{
			Value:    "ab",
			ErrCount: 1,
		},
		{
			Value:    "abc",
			ErrCount: 0,
		},
		{
			Value:    "cosmosDBAccount1",
			ErrCount: 1,
		},
		{
			Value:    "hello-world",
			ErrCount: 0,
		},
		{
			Value:    str,
			ErrCount: 0,
		},
		{
			Value:    str + "a",
			ErrCount: 1,
		},
	}

	for _, tc := range cases {
		_, errors := validateAzureRmCosmosDBAccountName(tc.Value, "azurerm_cosmosdb_account")

		if len(errors) != tc.ErrCount {
			t.Fatalf("Expected the AzureRM CosmosDB Name to trigger a validation error for '%s'", tc.Value)
		}
	}
}

func TestAccAzureRMCosmosDBAccount_boundedStaleness(t *testing.T) {

	ri := acctest.RandInt()
	config := testAccAzureRMCosmosDBAccount_boundedStaleness(ri, testLocation())

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy,
		Steps: []resource.TestStep{
			{
				Config: config,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMCosmosDBAccountExists("azurerm_cosmosdb_account.test"),
				),
			},
		},
	})
}

func TestAccAzureRMCosmosDBAccount_boundedStalenessComplete(t *testing.T) {

	ri := acctest.RandInt()
	config := testAccAzureRMCosmosDBAccount_boundedStalenessComplete(ri, testLocation())
<commit_msg>Adding a check for the Database Kind<commit_after>package azurerm

import (
	"fmt"
	"net/http"
	"testing"

	"github.com/hashicorp/terraform/helper/acctest"
	"github.com/hashicorp/terraform/helper/resource"
	"github.com/hashicorp/terraform/terraform"
)

func TestAccAzureRMCosmosDBAccountName_validation(t *testing.T) {
	str := acctest.RandString(50)
	cases := []struct {
		Value    string
		ErrCount int
	}{
		{
			Value:    "ab",
			ErrCount: 1,
		},
		{
			Value:    "abc",
			ErrCount: 0,
		},
		{
			Value:    "cosmosDBAccount1",
			ErrCount: 1,
		},
		{
			Value:    "hello-world",
			ErrCount: 0,
		},
		{
			Value:    str,
			ErrCount: 0,
		},
		{
			Value:    str + "a",
			ErrCount: 1,
		},
	}

	for _, tc := range cases {
		_, errors := validateAzureRmCosmosDBAccountName(tc.Value, "azurerm_cosmosdb_account")

		if len(errors) != tc.ErrCount {
			t.Fatalf("Expected the AzureRM CosmosDB Name to trigger a validation error for '%s'", tc.Value)
		}
	}
}

func TestAccAzureRMCosmosDBAccount_boundedStaleness(t *testing.T) {
	resourceName := "azurerm_cosmosdb_account.test"
	ri := acctest.RandInt()
	config := testAccAzureRMCosmosDBAccount_boundedStaleness(ri, testLocation())

	resource.Test(t, resource.TestCase{
		PreCheck:     func() { testAccPreCheck(t) },
		Providers:    testAccProviders,
		CheckDestroy: testCheckAzureRMCosmosDBAccountDestroy,
		Steps: []resource.TestStep{
			{
				Config: config,
				Check: resource.ComposeTestCheckFunc(
					testCheckAzureRMCosmosDBAccountExists(resourceName),
					resource.TestCheckResourceAttr(resourceName, "kind", "GlobalDocumentDB"),
				),
			},
		},
	})
}

func TestAccAzureRMCosmosDBAccount_boundedStalenessComplete(t *testing.T) {

	ri := acctest.RandInt()
	config := testAccAzureRMCosmosDBAccount_boundedStalenessComplete(ri, testLocation())

{'fraction_non_alphanumeric': 0.1258259120942258, 'fraction_numerical': 0.005170927894283252, 'mean_word_length': 4.010071942446043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '125564', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1323, 'n_words': 211}