TPT-4534: Flaky smoke tests fixes#818
Conversation
API does not return grants for unrestricted users so it is needed to handle _get_raw_grants with a condition
There was a problem hiding this comment.
Pull request overview
This PR addresses nightly smoke test flakiness by aligning integration test expectations with current API behavior and by making the user/database modules more tolerant of engine/version format and permission constraints.
Changes:
- Update VPC and Object Storage integration tests to use consistent region variables and updated validation/error expectations.
- Adjust MySQL integration tests to assert only the major engine version and remove unused variables from VPC-related MySQL tests.
- Prevent
usermodule from fetching grants for unrestricted users; update MySQL/PostgreSQL v2 modules to handle dotted engine versions when deriving the major version.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/targets/vpc_basic/tasks/main.yaml | Updates expected VPC invalid-label error message text. |
| tests/integration/targets/object_basic/tasks/main.yaml | Introduces a region variable and scopes object keys to that region; updates assertions accordingly. |
| tests/integration/targets/database_mysql_v2_vpc/tasks/main.yaml | Removes unused engine_version fact. |
| tests/integration/targets/database_mysql_v2_vpc_detach/tasks/main.yaml | Removes unused engine_version fact. |
| tests/integration/targets/database_mysql_v2_complex/tasks/main.yaml | Normalizes engine_version fact to major version for stable assertions. |
| tests/integration/targets/database_mysql_v2_basic/tasks/main.yaml | Normalizes engine_version fact to major version for stable assertions. |
| plugins/modules/user.py | Skips grants fetch for unrestricted users to avoid forbidden API calls. |
| plugins/modules/database_postgresql_v2.py | Parses major version from dotted engine version strings during update. |
| plugins/modules/database_mysql_v2.py | Parses major version from dotted engine version strings during update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ezilber-akamai
left a comment
There was a problem hiding this comment.
database_mysql_v2_complex failed for me locally due to the allow_list assertion. This issue pops up all the time in Terraform too, maybe we just shouldn't assert on this field?
Other than that I got the typical 500s but not much we can do about that. Overall looks good!
Hi @ezilber-akamai, it's a bit strange because I double checked it and I didn't face this issue. The only problem I had was incorrect db engine used for fork (playbook already updated) |
Maybe the differences we are seeing is due to different customer tags? Seems like a long shot but idk. Gotta love the inconsistency 😆 |
psnoch-akamai
left a comment
There was a problem hiding this comment.
LGTM and tests work with service account token
For me - it was working fine with service account. Do you use your own token? |
Yeah I used my own token. |
📝 Description
This PRs covers fixes for failing nightly smoke tests.
Additionally, following modules have been refactored:
plugins/modules/user.py- currently, grants cannot be retrieved for unrestricted users so "user_basic" playbook was failing on "Update the Linode User" task as it runs "_get_raw_grants" in the background. Decided to check if user is restricted first.plugins/modules/database_mysql_v2.py,plugins/modules/database_postgresql_v2.py- currently available version of mysql engine is in X.Y format so it cannot be converted into integer and properly used as major_version. Decided to split it and use string type instead of int✔️ How to Test
Tested with TPT test user
make test-int TEST_SUITE="instance_basic"make test-int TEST_SUITE="object_basic"make test-int TEST_SUITE="user_basic"make test-int TEST_SUITE="vpc_basic"make test-int TEST_SUITE="database_mysql_v2_basic"make test-int TEST_SUITE="database_mysql_v2_complex"make test-int TEST_SUITE="database_mysql_v2_vpc"make test-int TEST_SUITE="database_mysql_v2_vpc_detach"