Skip to content

Commit 09d6f18

Browse files
Add custom expiry duration test
1 parent cb45328 commit 09d6f18

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

ns1/resource_apikey_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,28 @@ func TestAccAPIKey_allExpiryDurations(t *testing.T) {
530530
}
531531
}
532532

533+
func TestAccAPIKey_customExpiryDuration(t *testing.T) {
534+
var apiKey account.APIKey
535+
name := acctest.RandStringFromCharSet(15, acctest.CharSetAlphaNum)
536+
537+
resource.Test(t, resource.TestCase{
538+
PreCheck: func() { testAccPreCheck(t) },
539+
Providers: testAccProviders,
540+
CheckDestroy: testAccCheckAPIKeyDestroy,
541+
Steps: []resource.TestStep{
542+
{
543+
Config: testAccAPIKeyWithExpiryDuration(name, "45d"),
544+
Check: resource.ComposeTestCheckFunc(
545+
testAccCheckAPIKeyExists("ns1_apikey.it", &apiKey),
546+
testAccCheckAPIKeyName(&apiKey, name),
547+
resource.TestCheckResourceAttr("ns1_apikey.it", "expiry_duration", "45d"),
548+
testAccCheckAPIKeyHasSecrets(&apiKey),
549+
),
550+
},
551+
},
552+
})
553+
}
554+
533555
func testAccAPIKeyPermissionsNoTeam(rString string) string {
534556
return fmt.Sprintf(`resource "ns1_team" "t" {
535557
name = "terraform acc test team %s"

0 commit comments

Comments
 (0)