Skip to content

Commit

Permalink
Fix failing tests (#1482)
Browse files Browse the repository at this point in the history
* cron schedule

* jenkins description during run

* jenkins description during run

* jenkins description during run

* cron modify

* interval between jobs

* modify time

* fix language code

* fix TestAccGenesysCloudOAuthResourceCredential test

* fix message integration tests

* fix failing tests

* fix failures

* fix testcases
  • Loading branch information
monishapadmavathi authored Jan 17, 2025
1 parent ff98146 commit eeb946a
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package conversations_messaging_integrations_open
import (
"fmt"
"testing"
"time"

cmMessagingSetting "terraform-provider-genesyscloud/genesyscloud/conversations_messaging_settings"
cmSupportedContent "terraform-provider-genesyscloud/genesyscloud/conversations_messaging_supportedcontent"
Expand All @@ -11,14 +12,14 @@ import (

"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

/*
Test Class for the conversations messaging integrations open Data Source
*/

func TestAccDataSourceConversationsMessagingIntegrationsOpen(t *testing.T) {
t.Parallel()
var (
dataSourceLabel = "data_test_messaging_open"
resourceLabel = "test_messaging_open"
Expand Down Expand Up @@ -70,9 +71,17 @@ func TestAccDataSourceConversationsMessagingIntegrationsOpen(t *testing.T) {
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair("data.genesyscloud_conversations_messaging_integrations_open."+dataSourceLabel, "id", "genesyscloud_conversations_messaging_integrations_open."+resourceLabel, "id"),
func(s *terraform.State) error {
time.Sleep(30 * time.Second) // Wait for 30 seconds for proper updation
return nil
},
),
},
},
CheckDestroy: func(state *terraform.State) error {
time.Sleep(60 * time.Second)
return testVerifyConversationsMessagingIntegrationsOpenDestroyed(state)
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package conversations_messaging_integrations_open
import (
"fmt"
"testing"
"time"

"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand All @@ -23,7 +24,6 @@ tests for conversations_messaging_integrations_open.
*/

func TestAccResourceConversationsMessagingIntegrationsOpen(t *testing.T) {
t.Parallel()
var (
resourceLabel = "test_messaging_open"
name = "Terraform Integrations Messaging Open " + uuid.NewString()
Expand Down Expand Up @@ -85,9 +85,18 @@ func TestAccResourceConversationsMessagingIntegrationsOpen(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"outbound_notification_webhook_signature_secret_token"},
Check: resource.ComposeTestCheckFunc(
func(s *terraform.State) error {
time.Sleep(30 * time.Second) // Wait for 30 seconds for proper updation
return nil
},
),
},
},
CheckDestroy: testVerifyConversationsMessagingIntegrationsOpenDestroyed,
CheckDestroy: func(state *terraform.State) error {
time.Sleep(60 * time.Second)
return testVerifyConversationsMessagingIntegrationsOpenDestroyed(state)
},
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func generateGenesysOauthCredentialResource(resourceLabel string, name string) s

return fmt.Sprintf(`
data "genesyscloud_auth_role" "admin" {
name = "Admin"
name = "admin"
}
resource "genesyscloud_oauth_client" "%s" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ func TestAccResourceRoutingQueueConditionalGroupRouting(t *testing.T) {
return nil
},
),
PreventPostDestroyRefresh: true,
},
{
// Import/Read
Expand All @@ -274,7 +273,7 @@ func TestAccResourceRoutingQueueConditionalGroupRouting(t *testing.T) {
},
},
CheckDestroy: func(state *terraform.State) error {
time.Sleep(40 * time.Second)
time.Sleep(60 * time.Second)
return testVerifyGroupsAndUsersDestroyed(state)
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"terraform-provider-genesyscloud/genesyscloud/user"
"terraform-provider-genesyscloud/genesyscloud/util"
"testing"
"time"

"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccDataSourcePhone(t *testing.T) {
t.Parallel()
var (
phoneResourceLabel = "phone1234"
phoneDataResourceLabel = "phoneData"
Expand Down Expand Up @@ -43,6 +43,9 @@ func TestAccDataSourcePhone(t *testing.T) {
ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
Steps: []resource.TestStep{
{
PreConfig: func() {
time.Sleep(30 * time.Second)
},
Config: user.GenerateUserResource(
userResourceLabel1,
userEmail1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ func TestAccResourcePhoneBasic(t *testing.T) {
ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
Steps: []resource.TestStep{
{
PreConfig: func() {
time.Sleep(30 * time.Second)
},
Config: config1,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("genesyscloud_telephony_providers_edges_phone."+phoneResourceLabel, "name", name1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
)

func TestAccResourceSite(t *testing.T) {
t.Parallel()

var (
// site
Expand Down
5 changes: 4 additions & 1 deletion genesyscloud/user/resource_genesyscloud_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,10 @@ func TestAccResourceUserRestore(t *testing.T) {
),
},
},
CheckDestroy: testVerifyUsersDestroyed,
CheckDestroy: func(state *terraform.State) error {
time.Sleep(45 * time.Second)
return testVerifyUsersDestroyed(state)
},
})
}

Expand Down

0 comments on commit eeb946a

Please sign in to comment.