-
Notifications
You must be signed in to change notification settings - Fork 115
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
[6.15.z] remove user to prevent ForeignKeyViolation #17534
base: 6.15.z
Are you sure you want to change the base?
[6.15.z] remove user to prevent ForeignKeyViolation #17534
Conversation
xremove user to prevent ForeignKeyViolation (cherry picked from commit c2acadb)
trigger: test-robottelo |
PRT Result
|
trigger: test-robottelo |
PRT Result
|
@@ -296,6 +296,9 @@ def test_positive_read_facts_with_filter( | |||
host.organization = module_org | |||
host.location = module_location | |||
host.update(['organization', 'location']) | |||
request.addfinalizer( | |||
user.delete | |||
) # Adding a temporary workaround until the issue 'SAT-18656' is resolved. |
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.
If this is a temporary workaround, why isn't there a condition for that issue being resolved? The same for the original PR.
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.
Earlier, I tried using the condition, but it didn't work. So, I attempted this approach instead. However, the issue is that this change works sometimes but not consistently. I'm not sure why the behavior varies.
In PRT:
It seems like the test actually caught that exact issue, perhaps meaning that the workaround doesn't work? |
Cherrypick of PR: #17024
Problem -
When creating another user with a specific role and adding resources in the filter with the 'view_facts' permission, an error occurred ('PG::ForeignKeyViolation: ERROR: update or delete on table "hosts" violates foreign key constraint "fact_values_host_id_fk" on table "fact_values"') during the teardown process while deleting the host. This happened because a user with only view permissions existed for the host and making it impossible to update or delete the user associated with the fact.
Solution -
To prevent this error, the user was removed before the teardown process.