-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test for Namespace Already Exists
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
@@ -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"), | ||
}, | ||
}, | ||
}) | ||
} |