Skip to content

Fix order-dependent Gitaly specs failing

Stan Hu requested to merge sh-fix-gitaly-specs-failing into master

If spec/tasks/gitlab/cleanup_rake_spec.rb preceded any of the Gitaly request specs, it would import the cleanup.rake and the global function limit. For some reason, the Protobuf implementation would use the global function instead of the getter method (most likely due to https://github.com/protocolbuffers/protobuf/blob/8b0968625331457e79ba2e7eef5b35af3a95129e/ruby/ext/google/protobuf_c/message.c#L294-L296). For example:

def limit
  puts "hi"
end

req = Gitaly::WikiGetAllPagesRequest.new
req.send(:limit)
hi
=> nil

To fix this problem, access the field value using the [] operator instead.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64006

Edited by Stan Hu

Merge request reports