-
Notifications
You must be signed in to change notification settings - Fork 346
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
Bugfix/5405 parent child tenant update #5474
Bugfix/5405 parent child tenant update #5474
Conversation
As it stands currently, there is a bug where you can update a Tenant and select a child of said tenant to be the new parent. This causes a circular reference in the database with the adjanceny list and then prevents the child and parent from being returned in the recursive CTE, which makes it appear as though those values have been deleted. > Note that should this happen it is still possible to salvage the data by manually editing the `tenants` table and fixing the incorrect parent/child relationship. To prevent the problem, a check is done to ensure the chosen ParentID does not reside in the current list of children when attempting to update the Tenant.
usererr, syserr, statusCode := ten.isUpdatable() | ||
if usererr != nil || syserr != nil { | ||
return usererr, syserr, statusCode |
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.
just for consistency in the project, would you mind changing these to userErr
and sysErr
? and in a couple places down below as well? sorry for such a nitpicky comment
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.
Hey! Great catch. I had it in my head to dbl chk before submitting, but apparently missed it. Thanks for getting that.
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.
Looks great! unit and API tests pass, manual testing works as expected
What does this PR (Pull Request) do?
Which Traffic Control components are affected by this PR?
No documentation is required as this is a bug fix to align with expected behavior.
What is the best way to verify this PR?
A Go Unit Test has been added to ensure this behavior is ensured in the future.
Manual testing can be performed for verification as well.
If this is a bug fix, what versions of Traffic Control are affected?
The following criteria are ALL met by this PR
Additional Information
Some additional cleanup was performed as well, such as using the same name for the receiver throughout
tenant.go
and comments added.