Use correct arg name

So funny story, true story. I tried to run the test locally, but
didn't make it past setting up Gitaly.

Here's what I tried:

First attempt:

`git clone gitlab-ce`
`cd gitlab-ce && bundle install`
`be rspec`

This didn't work because I was missing the config/database.yml, I
didn't see a `script/bootstrap` so I looked in the readme which
redirected me to a webpage which redirected me to the
gitlab-development-kit.

Second attempt:

`gem install gitlab-development-kit`
cd gitlab-development-kit
gdk init
gdk isntall

This broke somwhere along the way because it couldn't install Gitaly
because my go version was too low. But it did clone the gitlab repo
again and this time it did have a config/database.yml.

So I tried to cd into it and `be rspec
spec/lib/gitlab/database/migration_helpers_spec.rb` which complained
about the database not being configured so I:

- Changed the socket to localhost (in the config/database.yml)
- `createdb <dev_db>` `createdb test_db`
- `be rake db:test:prepare`

Great success, it was doing things! But then failed when it came at
the Gitaly step.

Since I only want to change these three lines, at the point I gave up
and entrusted the pipeline to do its thing.

What I would have liked:

- A 'It's a Rails system, I know this' readme/docs (It's in there
  somewhere just couldn't find it)
- A way to run tests without having to use Gitaly
- Not having too install all the things for a small fix (I get why'd
  you want this, but to me it's overkill)
This commit is contained in:
pjaspers 2019-06-19 13:55:31 +02:00
parent 31438ddd8b
commit 6f5daf49d9

View file

@ -225,7 +225,7 @@ module Gitlab
# here is based on Rails' foreign_key_name() method, which unfortunately
# is private so we can't rely on it directly.
def concurrent_foreign_key_name(table, column)
identifier = "#{table_name}_#{column}_fk"
identifier = "#{table}_#{column}_fk"
hashed_identifier = Digest::SHA256.hexdigest(identifier).first(10)
"fk_#{hashed_identifier}"