Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/DEVTOOLING-167 #1490

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

feature/DEVTOOLING-167 #1490

wants to merge 2 commits into from

Conversation

sureshperiyappan
Copy link
Collaborator

Team,

I am getting the below error while running the acceptance testing, looks strange to me, still working on the issue.

2025/01/21 18:53:53 [DEBUG] Waiting for state to become: [success]
=== RUN TestAccResourceJourneySegment
2025/01/21 18:53:54 [DEBUG] Waiting for state to become: [success]
2025/01/21 18:53:55 Generated 2 test steps for testcase => ../..\test\data\resource\genesyscloud_journey_segment\basic_attributes
c:\1gcwork\devtooling\terraform-provider-genesyscloud\genesyscloud\journey_segment\testing_new.go:85: Error running post-test destroy, there may be dangling resources: exit status 1

    Error: journey journey c9e9c1b7-84df-4ad0-bb56-b8357dcbcc56 still exists
    {"resourceType":"genesyscloud_journey_segment","errorMessage":"Unable to build a message from the response because the APIResponse does not contain the appropriate data."}

@@ -8,6 +8,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/architect_schedulegroups"
"terraform-provider-genesyscloud/genesyscloud/architect_schedules"
authDivision "terraform-provider-genesyscloud/genesyscloud/auth_division"
"terraform-provider-genesyscloud/genesyscloud/journey_segment"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

journey_segment -> journeySegment

"terraform-provider-genesyscloud/genesyscloud/journey_action_map"
"terraform-provider-genesyscloud/genesyscloud/journey_segment"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

journey_segment -> journeySegment

@@ -41,13 +27,13 @@ func dataSourceJourneySegmentRead(ctx context.Context, d *schema.ResourceData, m
const pageSize = 100
journeySegments, resp, getErr := journeyApi.GetJourneySegments("", pageSize, pageNum, true, nil, nil, "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be using the proxy in this file also

return *segment.Id, false, resp, nil
}
}
return "", false, resp, fmt.Errorf("No journey segment found with name %s", name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retryable should be true here

func getJourneySegmentIdByNameFn(ctx context.Context, p *journeySegmentProxy, name string) (id string, retryable bool, response *platformclientv2.APIResponse, err error) {
segments, resp, err := p.getAllJourneySegmentsAttr(ctx, p)
if err != nil {
return "", true, resp, err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retryable should be false here

Copy link
Collaborator

@charliecon charliecon Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add a nil and length check of segments before we try to loop through it. If nil or length == 0 { return a none found error with retryable = true }

criteriaMap["values"] = lists.StringListToSet(*criteria.Values)
criteriaMap["should_ignore_case"] = *criteria.ShouldIgnoreCase
criteriaMap["operator"] = *criteria.Operator
return criteriaMap
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And these

@@ -75,7 +75,7 @@ func GenerateTestSteps(testType string, resourceType string, testCaseName string
var testSteps []resource.TestStep
var testCasePath string
testCasePath = GetTestDataPath(testType, resourceType, testCaseName)
if resourceType == "genesyscloud_journey_action_map" || resourceType == "genesyscloud_journey_action_template" {
if resourceType == "genesyscloud_journey_action_map" || resourceType == "genesyscloud_journey_action_template" || resourceType == "genesyscloud_journey_segment" {
testCasePath = path.Join("../", testCasePath)
Copy link
Collaborator

@charliecon charliecon Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the "/" from the string on this line, I think it might fix the error you outlined in the comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was added to handle the few packages were refracted and few were not and the directory structure one step should be prefixed, now i have removed that condition as all the journey package have been refactored

journeyPatternMap["count"] = *journeyPattern.Count
journeyPatternMap["stream_type"] = *journeyPattern.StreamType
journeyPatternMap["session_type"] = *journeyPattern.SessionType
stringmap.SetValueIfNotNil(journeyPatternMap, "event_name", journeyPattern.EventName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

criteriaMap["values"] = lists.StringListToSet(*criteria.Values)
criteriaMap["should_ignore_case"] = *criteria.ShouldIgnoreCase
criteriaMap["operator"] = *criteria.Operator
return criteriaMap
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

entityTypeCriteriaMap["should_ignore_case"] = *entityTypeCriteria.ShouldIgnoreCase
entityTypeCriteriaMap["operator"] = *entityTypeCriteria.Operator
entityTypeCriteriaMap["entity_type"] = *entityTypeCriteria.EntityType
return entityTypeCriteriaMap
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Collaborator

@HemanthDogiparthi12 HemanthDogiparthi12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. once all the comments too are addressed.

@@ -46,7 +47,7 @@ func (r *registerTestInstance) registerTestResources() {
providerResources[architect_schedules.ResourceType] = architect_schedules.ResourceArchitectSchedules()
providerResources[architect_schedulegroups.ResourceType] = architect_schedulegroups.ResourceArchitectSchedulegroups()
providerResources[architect_flow.ResourceType] = architect_flow.ResourceArchitectFlow()
providerResources["genesyscloud_journey_segment"] = gcloud.ResourceJourneySegment()
providerResources[journey_segment.ResourceType] = journey_segment.ResourceJourneySegment()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can name the package to journeySegment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants