Skip to content

Commit

Permalink
Adding test for Namespace Already Exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Frankel-Lopez committed Jul 25, 2024
1 parent 213d0bc commit 22aa3f3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions internal/provider/namespace_resource_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package provider_test

import (
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand Down Expand Up @@ -50,3 +51,31 @@ resource "temporal_namespace" "test" {
},
})
}

func TestAccNamespaceAlreadyExsits(t *testing.T) {
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
{
Config: providerConfig + `
resource "temporal_namespace" "test1" {
name = "test"
description = "This is a test namespace"
owner_email = "[email protected]"
}`,
},
// Namespace already exists Error
{
Config: providerConfig + `
resource "temporal_namespace" "test2" {
name = "test"
description = "This is a test namespace"
owner_email = "[email protected]"
}
`,
ExpectError: regexp.MustCompile("namespace registration failed.*code = AlreadyExists"),
},
},
})
}

0 comments on commit 22aa3f3

Please sign in to comment.