From 1456ae62d359d34be72ba31e2b270bf7c55df715 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Tue, 18 Sep 2018 15:13:25 +0200 Subject: [PATCH] Explicitly set Linguist languages during tests Locally, tests failed when these required a Gitaly server to start, 3 tests failed as the server was unable to find the Linguist colors. This is fixed by skipping autodetection, and overriding the default value. Observed tests that failed: ``` rspec ./spec/gitaly/ref_service_spec.rb:11 rspec ./spec/gitaly/repository_service_spec.rb:10 rspec ./spec/gitaly/repository_service_spec.rb:16 ``` Of these, now only the ref_service_spec.rb is still failing, but with a deadline exceeded error. This seems like the server is slow to start, somehow. Given my gut feeling says its unrelated, it will be fixed in a later commit. --- config.toml.example | 3 +++ ruby/spec/integration_helper.rb | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.toml.example b/config.toml.example index 0822e8ca188..b3cd6057e18 100644 --- a/config.toml.example +++ b/config.toml.example @@ -63,6 +63,9 @@ dir = "/home/git/gitaly/ruby" # # # Number of gitaly-ruby worker processes # num_workers = 2 +# +# # Override Linguist languages path +# linguist_languages_path = "" [gitlab-shell] # The directory where gitlab-shell is installed diff --git a/ruby/spec/integration_helper.rb b/ruby/spec/integration_helper.rb index 0186d051425..b4e118ff9cc 100644 --- a/ruby/spec/integration_helper.rb +++ b/ruby/spec/integration_helper.rb @@ -18,19 +18,24 @@ end def start_gitaly build_dir = File.expand_path('../../../_build', __FILE__) gitlab_shell_dir = File.join(TMP_DIR, 'gitlab-shell') + linguist_path = File.join( + Bundler.rubygems.find_name('github-linguist').first.full_gem_path, + "lib", "linguist", "languages.json" + ) FileUtils.mkdir_p([TMP_DIR, File.join(gitlab_shell_dir, 'hooks')]) config_toml = <<~CONFIG socket_path = "#{SOCKET_PATH}" bin_dir = "#{build_dir}/bin" - + [gitlab-shell] dir = "#{gitlab_shell_dir}" - + [gitaly-ruby] dir = "#{build_dir}/assembly/ruby" - + linguist_languages_path = "#{linguist_path}" + [[storage]] name = "#{DEFAULT_STORAGE_NAME}" path = "#{DEFAULT_STORAGE_DIR}" -- GitLab