Skip to content

Commit

Permalink
Merge pull request #1267 from okta/emanor_context_deadline_exceeded
Browse files Browse the repository at this point in the history
ACC tests for resource changes in PR #1207
  • Loading branch information
monde authored Aug 25, 2022
2 parents a0c18da + 069ff72 commit 47fafaa
Show file tree
Hide file tree
Showing 9 changed files with 354 additions and 1 deletion.
32 changes: 32 additions & 0 deletions okta/resource_okta_app_auto_login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,35 @@ func TestAccAppAutoLoginApplication_crud(t *testing.T) {
},
})
}

func TestAccAppAutoLoginApplication_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appAutoLogin)
resourceName := fmt.Sprintf("%s.test", appAutoLogin)
config := `
resource "okta_app_auto_login" "test" {
label = "testAcc_replace_with_uuid"
sign_on_url = "https://example.com/login.html"
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appAutoLogin, createDoesAppExist(okta.NewAutoLoginApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
33 changes: 33 additions & 0 deletions okta/resource_okta_app_basic_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,36 @@ func TestAccAppBasicAuthApplication_crud(t *testing.T) {
},
})
}

func TestAccAppBasicAuthApplication_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appBasicAuth)
resourceName := fmt.Sprintf("%s.test", appBasicAuth)
config := `
resource "okta_app_basic_auth" "test" {
label = "testAcc_replace_with_uuid"
url = "https://example.com/login.html"
auth_url = "https://example.com/auth.html"
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appBasicAuth, createDoesAppExist(okta.NewBasicAuthApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
32 changes: 32 additions & 0 deletions okta/resource_okta_app_bookmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,35 @@ func TestAccAppBookmarkApplication_crud(t *testing.T) {
},
})
}

func TestAccAppBookmarkApplication_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appBookmark)
resourceName := fmt.Sprintf("%s.test", appBookmark)
config := `
resource "okta_app_bookmark" "test" {
label = "testAcc_replace_with_uuid"
url = "https://test.com"
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appBookmark, createDoesAppExist(okta.NewBookmarkApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
57 changes: 57 additions & 0 deletions okta/resource_okta_app_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,63 @@ func TestAccAppGroupAssignment_retain(t *testing.T) {
})
}

func TestAccAppGroupAssignment_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appGroupAssignment)
resourceName0 := fmt.Sprintf("%s.test.0", appGroupAssignment)
config := `
resource "okta_app_oauth" "test" {
label = "testAcc_replace_with_uuid"
type = "web"
grant_types = ["implicit", "authorization_code"]
redirect_uris = ["http://d.com/"]
response_types = ["code", "token", "id_token"]
issuer_mode = "ORG_URL"
lifecycle {
ignore_changes = [users, groups]
}
}
resource "okta_group" "test" {
name = "testAcc_replace_with_uuid"
}
locals {
group_ids = tolist([okta_group.test.id])
}
resource "okta_app_group_assignment" "test" {
count = length(local.group_ids)
app_id = okta_app_oauth.test.id
group_id = local.group_ids[count.index]
priority = count.index
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}
`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: testAccCheckUserDestroy,
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName0, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName0, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName0, "timeouts.update", "30m"),
),
},
},
})
}

func ensureAppGroupAssignmentExists(name string) resource.TestCheckFunc {
return func(s *terraform.State) error {
missingErr := fmt.Errorf("resource not found: %s", name)
Expand Down
40 changes: 39 additions & 1 deletion okta/resource_okta_app_oauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ resource "%s" "test" {
}

// TestAccResourceOktaAppOauth_redirect_uris relates to issue 1170
// Enable terraform to maintain order of redirect_uris
//
// Enable terraform to maintain order of redirect_uris
//
// https://github.com/okta/terraform-provider-okta/issues/1170
func TestAccResourceOktaAppOauth_redirect_uris(t *testing.T) {
resourceName := fmt.Sprintf("%s.test", appOAuth)
Expand Down Expand Up @@ -465,3 +467,39 @@ func TestAccResourceOktaAppOauth_groups_claim(t *testing.T) {
},
})
}

func TestAccResourceOktaAppOauth_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appOAuth)
resourceName := fmt.Sprintf("%s.test", appOAuth)
config := `
resource "okta_app_oauth" "test" {
label = "testAcc_replace_with_uuid"
type = "web"
grant_types = ["authorization_code"]
redirect_uris = ["http://d.com/"]
response_types = ["code"]
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}
`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appOAuth, createDoesAppExist(okta.NewOpenIdConnectApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
54 changes: 54 additions & 0 deletions okta/resource_okta_app_saml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,57 @@ resource "%s" "%s" {
}
`, appSaml, name, name)
}

func TestAccResourceOktaAppSaml_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appSaml)
resourceName := fmt.Sprintf("%s.test", appSaml)
config := `
resource "okta_app_saml" "test" {
label = "testAcc_replace_with_uuid"
sso_url = "http://google.com"
recipient = "http://here.com"
destination = "http://its-about-the-journey.com"
audience = "http://audience.com"
subject_name_id_template = "$${user.userName}"
subject_name_id_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
response_signed = true
signature_algorithm = "RSA_SHA256"
digest_algorithm = "SHA256"
honor_force_authn = false
authn_context_class_ref = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
single_logout_issuer = "https://dunshire.okta.com"
single_logout_url = "https://dunshire.okta.com/logout"
single_logout_certificate = "MIIFnDCCA4QCCQDBSLbiON2T1zANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxDjAMBgNV\r\nBAgMBU1haW5lMRAwDgYDVQQHDAdDYXJpYm91MRcwFQYDVQQKDA5Tbm93bWFrZXJzIEluYzEUMBIG\r\nA1UECwwLRW5naW5lZXJpbmcxDTALBgNVBAMMBFNub3cxIDAeBgkqhkiG9w0BCQEWEWVtYWlsQGV4\r\nYW1wbGUuY29tMB4XDTIwMTIwMzIyNDY0M1oXDTMwMTIwMTIyNDY0M1owgY8xCzAJBgNVBAYTAlVT\r\nMQ4wDAYDVQQIDAVNYWluZTEQMA4GA1UEBwwHQ2FyaWJvdTEXMBUGA1UECgwOU25vd21ha2VycyBJ\r\nbmMxFDASBgNVBAsMC0VuZ2luZWVyaW5nMQ0wCwYDVQQDDARTbm93MSAwHgYJKoZIhvcNAQkBFhFl\r\nbWFpbEBleGFtcGxlLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANMmWDjXPdoa\r\nPyzIENqeY9njLan2FqCbQPSestWUUcb6NhDsJVGSQ7XR+ozQA5TaJzbP7cAJUj8vCcbqMZsgOQAu\r\nO/pzYyQEKptLmrGvPn7xkJ1A1xLkp2NY18cpDTeUPueJUoidZ9EJwEuyUZIktzxNNU1pA1lGijiu\r\n2XNxs9d9JR/hm3tCu9Im8qLVB4JtX80YUa6QtlRjWR/H8a373AYCOASdoB3c57fIPD8ATDNy2w/c\r\nfCVGiyKDMFB+GA/WTsZpOP3iohRp8ltAncSuzypcztb2iE+jijtTsiC9kUA2abAJqqpoCJubNShi\r\nVff4822czpziS44MV2guC9wANi8u3Uyl5MKsU95j01jzadKRP5S+2f0K+n8n4UoV9fnqZFyuGAKd\r\nCJi9K6NlSAP+TgPe/JP9F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EX"
filter_value = ".*"
}
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}
`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appSaml, createDoesAppExist(okta.NewSamlApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
35 changes: 35 additions & 0 deletions okta/resource_okta_app_secure_password_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,38 @@ func TestAccAppSecurePasswordStoreApplication_credsSchemes(t *testing.T) {
},
})
}

func TestAccAppSecurePasswordStoreApplication_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appSecurePasswordStore)
resourceName := fmt.Sprintf("%s.test", appSecurePasswordStore)
config := `
resource "okta_app_secure_password_store" "test" {
label = "testAcc_replace_with_uuid"
username_field = "user"
password_field = "pass"
url = "http://test.com"
credentials_scheme = "ADMIN_SETS_CREDENTIALS"
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appSecurePasswordStore, createDoesAppExist(okta.NewSecurePasswordStoreApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
37 changes: 37 additions & 0 deletions okta/resource_okta_app_shared_credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,40 @@ func TestAccAppSharedCredentials_crud(t *testing.T) {
},
})
}

func TestAccAppSharedCredentials_timeouts(t *testing.T) {
ri := acctest.RandInt()
mgr := newFixtureManager(appSharedCredentials)
resourceName := fmt.Sprintf("%s.test", appSharedCredentials)
config := `
resource "okta_app_shared_credentials" "test" {
label = "testAcc_replace_with_uuid"
button_field = "btn-login"
username_field = "txtbox-username"
password_field = "txtbox-password"
url = "https://example.com/login-updated.html"
shared_username = "sharedusername"
shared_password = "sharedpass"
timeouts {
create = "60m"
read = "2h"
update = "30m"
}
}`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: testAccProvidersFactories,
CheckDestroy: createCheckResourceDestroy(appSharedCredentials, createDoesAppExist(okta.NewBrowserPluginApplication())),
Steps: []resource.TestStep{
{
Config: mgr.ConfigReplace(config, ri),
Check: resource.ComposeTestCheckFunc(
ensureResourceExists(resourceName, createDoesAppExist(okta.NewAutoLoginApplication())),
resource.TestCheckResourceAttr(resourceName, "timeouts.create", "60m"),
resource.TestCheckResourceAttr(resourceName, "timeouts.read", "2h"),
resource.TestCheckResourceAttr(resourceName, "timeouts.update", "30m"),
),
},
},
})
}
Loading

0 comments on commit 47fafaa

Please sign in to comment.