-
Notifications
You must be signed in to change notification settings - Fork 188
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
fix: Fixes config flaky tests #1680
Conversation
This reverts commit ae6d707.
concurrency: | ||
group: acctest-config | ||
cancel-in-progress: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run config jobs sequentially so they don't interfere each other
@@ -222,10 +222,13 @@ func dataSourceChecksForUsers(dataSourceName, orgID string, users *admin.Paginat | |||
resource.TestCheckResourceAttr(dataSourceName, "org_id", orgID), | |||
resource.TestCheckResourceAttr(dataSourceName, "total_count", fmt.Sprintf("%d", totalCountValue)), | |||
} | |||
skipUsername := os.Getenv("MONGODB_ATLAS_USERNAME_CLOUD_DEV") // this user can be changed by other tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't check the user that might be changed by other tests in this execution
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%steam_ids.#", attrPrefix), fmt.Sprintf("%d", len(user.TeamIds))), | ||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%slinks.#", attrPrefix), fmt.Sprintf("%d", len(user.Links))), | ||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%sroles.#", attrPrefix), fmt.Sprintf("%d", len(user.Roles))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change order in case it fails to know if team_ids or links fail before
@@ -66,7 +66,6 @@ func dataSourceChecksForUser(dataSourceName, attrPrefix string, user *admin.Clou | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%smobile_number", attrPrefix), user.MobileNumber), | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%scountry", attrPrefix), user.Country), | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%screated_at", attrPrefix), *conversion.TimePtrToStringPtr(user.CreatedAt)), | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%sroles.#", attrPrefix), fmt.Sprintf("%d", len(user.Roles))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roles are changed by other tests. (still singular datasource is checking roles and it uses the same code as plural one so removing this check shouldn't be a problem)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe singular data source is using the same dataSourceChecksForUser
for generating checks. Nevertheless agree with the approach, or we can simply check that roles attribute is defined.
@@ -66,7 +66,6 @@ func dataSourceChecksForUser(dataSourceName, attrPrefix string, user *admin.Clou | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%smobile_number", attrPrefix), user.MobileNumber), | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%scountry", attrPrefix), user.Country), | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%screated_at", attrPrefix), *conversion.TimePtrToStringPtr(user.CreatedAt)), | |||
resource.TestCheckResourceAttr(dataSourceName, fmt.Sprintf("%sroles.#", attrPrefix), fmt.Sprintf("%d", len(user.Roles))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe singular data source is using the same dataSourceChecksForUser
for generating checks. Nevertheless agree with the approach, or we can simply check that roles attribute is defined.
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func dataSourceChecksForUser(dataSourceName, attrPrefix string, user *admin.CloudAppUser) []resource.TestCheckFunc { | ||
func dataSourceChecksForUser(dataSourceName, attrPrefix string, user *admin.CloudAppUser, hasToCheckCountRoles bool) []resource.TestCheckFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AgustinBettati you're right, changing to keep role count in singular, just check attribute exists in plural
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Jira ticket: INTMDB-1342
Fixes config flaky tests.
Type of change:
Required Checklist:
Further comments