Skip to content

Don't write directly into an object pool in tests

Sami Hiltunen requested to merge smh-no-direct-pool-write into master

What does this MR do and why?

Don't write directly into an object pool in tests

Gitaly's hooks are currently entirely disabled in Rails specs. This is to avoid calling into Rails' internal API as it's not setup in the tests. This will change soon as Gitaly starts relying on the hooks itself with the upcoming transaction support. While Rails' own calls will still be stubbed out, Gitaly will run its own logic in the hooks. Validation logic in the hooks fails when calling user_commit_files on an object pool directly. This is because the RPC will invoke the authorization checks and thus runs the hook logic. The hook logic checks for gl_repository being set which is not the case for an object pool. Typically writes wouldn't be done directly into an object pool either. Update the test to write the object into another repository and fetch it into the object pool to avoid writing directly into the pool and triggering the access checks.

Fixes the failure in https://gitlab.com/gitlab-org/gitlab/-/jobs/6647631117

Merge request reports