diff options
author | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2022-10-31 20:05:47 +0300 |
---|---|---|
committer | Quang-Minh Nguyen <qmnguyen@gitlab.com> | 2022-11-01 10:37:37 +0300 |
commit | 0d2baa826945678103c49f76645e276e3cd1633b (patch) | |
tree | 942919d13d41f4f502621fa3c35a90ec9228270c | |
parent | fe3f065666a393561a6a6a4b0a32df914b017918 (diff) |
ruby: Clean up gems and test configurationsqmnguyen0711/remove-rugged-in-gitaly
Changelog: other
-rw-r--r-- | ruby/.rubocop_todo.yml | 7 | ||||
-rw-r--r-- | ruby/Gemfile | 7 | ||||
-rw-r--r-- | ruby/Gemfile.lock | 6 | ||||
-rw-r--r-- | ruby/lib/gitaly_server.rb | 2 | ||||
-rw-r--r-- | ruby/spec/factories/gitaly/commit_author.rb | 9 | ||||
-rw-r--r-- | ruby/spec/factories/sequences.rb | 4 | ||||
-rw-r--r-- | ruby/spec/test_repo_helper.rb | 60 |
7 files changed, 1 insertions, 94 deletions
diff --git a/ruby/.rubocop_todo.yml b/ruby/.rubocop_todo.yml index 87453d9e6..b0e943dcb 100644 --- a/ruby/.rubocop_todo.yml +++ b/ruby/.rubocop_todo.yml @@ -219,13 +219,6 @@ Style/RaiseArgs: - 'lib/gitlab/git/operation_service.rb' - 'lib/gitlab/git/remote_repository.rb' -# Offense count: 5 -# Cop supports --auto-correct. -Style/RedundantSelf: - Exclude: - - 'lib/gitlab/git.rb' - - 'lib/gitlab/git/blob.rb' - # Offense count: 14 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. diff --git a/ruby/Gemfile b/ruby/Gemfile index 26608e43a..69ad5dbf1 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -4,10 +4,8 @@ gem 'rugged', '~> 1.2' gem 'github-linguist', '~> 7.20.0', require: 'linguist' gem 'gitlab-markup', '~> 1.7.1' gem 'activesupport', '~> 6.1.6.1' -gem 'rdoc', '~> 6.0' gem 'grpc', '~> 1.42.0' # keep in lock-step with grpc-tools gem 'sentry-raven', '~> 3.0', require: false -gem 'faraday', '~> 1.0' gem 'rbtrace', require: false # The Gitaly Gem contains the Protobuf and gRPC definitions required by the @@ -23,11 +21,6 @@ gem 'licensee', '~> 9.15' gem 'google-protobuf', '~> 3.21.8' -# Rails is currently blocked on the upgrade to the new major version for Redis, -# so we don't upgrade either until the issue is resolved. This is an indirect -# dependency and can thus be removed when the version constraint is gone. -gem 'redis', '~> 4.7.1' - group :development, :test do gem 'rubocop', '~> 0.69', require: false gem 'rspec', require: false diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 9759bbf0e..81b588981 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -134,7 +134,6 @@ GEM ffi (>= 1.0.6) msgpack (>= 0.4.3) optimist (>= 3.0.0) - rdoc (6.3.2) redis (4.7.1) regexp_parser (1.8.1) reverse_markdown (1.4.0) @@ -205,7 +204,6 @@ PLATFORMS DEPENDENCIES activesupport (~> 6.1.6.1) factory_bot - faraday (~> 1.0) gitaly (~> 15.5.0) github-linguist (~> 7.20.0) gitlab-labkit (~> 0.26) @@ -216,8 +214,6 @@ DEPENDENCIES licensee (~> 9.15) pry (~> 0.12.2) rbtrace - rdoc (~> 6.0) - redis (~> 4.7.1) rspec rspec-parameterized rubocop (~> 0.69) @@ -226,4 +222,4 @@ DEPENDENCIES timecop BUNDLED WITH - 2.3.23 + 2.3.24 diff --git a/ruby/lib/gitaly_server.rb b/ruby/lib/gitaly_server.rb index 168eb08e9..17f303ac0 100644 --- a/ruby/lib/gitaly_server.rb +++ b/ruby/lib/gitaly_server.rb @@ -1,13 +1,11 @@ $:.unshift(File.expand_path('../proto', __dir__)) require 'gitaly' -# External dependencies of Gitlab::Git require 'linguist/blob_helper' require 'securerandom' require 'gitlab-labkit' require 'rugged' -# Ruby on Rails mix-ins that GitLab::Git code relies on require 'active_support/core_ext/object/blank' require 'active_support/core_ext/numeric/bytes' require 'active_support/core_ext/numeric/time' diff --git a/ruby/spec/factories/gitaly/commit_author.rb b/ruby/spec/factories/gitaly/commit_author.rb deleted file mode 100644 index aaf634ce0..000000000 --- a/ruby/spec/factories/gitaly/commit_author.rb +++ /dev/null @@ -1,9 +0,0 @@ -FactoryBot.define do - factory :gitaly_commit_author, class: Gitaly::CommitAuthor do - skip_create - - name { generate(:name) } - email { generate(:email) } - date { Google::Protobuf::Timestamp.new(seconds: Time.now.to_i) } - end -end diff --git a/ruby/spec/factories/sequences.rb b/ruby/spec/factories/sequences.rb deleted file mode 100644 index 16a05b1ca..000000000 --- a/ruby/spec/factories/sequences.rb +++ /dev/null @@ -1,4 +0,0 @@ -FactoryBot.define do - sequence(:name) { |n| "John Doe#{n}" } - sequence(:email) { |n| "user#{n}@example.org" } -end diff --git a/ruby/spec/test_repo_helper.rb b/ruby/spec/test_repo_helper.rb index e8fd142a2..a71c763f2 100644 --- a/ruby/spec/test_repo_helper.rb +++ b/ruby/spec/test_repo_helper.rb @@ -48,43 +48,10 @@ module TestRepo end end - def git_test_repo_read_only - Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: File.basename(GIT_TEST_REPO_PATH)) - end - def test_repo_read_only Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: File.basename(TEST_REPO_PATH)) end - def new_mutable_test_repo - relative_path = random_repository_relative_path(:mutable) - TestRepo.clone_new_repo!(TEST_REPO_ORIGIN, File.join(DEFAULT_STORAGE_DIR, relative_path)) - Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: relative_path) - end - - def new_mutable_git_test_repo - relative_path = random_repository_relative_path(:mutable) - TestRepo.clone_new_repo!(GIT_TEST_REPO_ORIGIN, File.join(DEFAULT_STORAGE_DIR, relative_path)) - Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: relative_path) - end - - def new_broken_test_repo - relative_path = random_repository_relative_path(:broken) - repo_path = File.join(DEFAULT_STORAGE_DIR, relative_path) - TestRepo.clone_new_repo!(TEST_REPO_ORIGIN, repo_path) - - refs_path = File.join(repo_path, 'refs') - FileUtils.rm_r(refs_path) - - Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: relative_path) - end - - def new_empty_test_repo - relative_path = random_repository_relative_path(:mutable) - TestRepo.init_new_repo!(File.join(DEFAULT_STORAGE_DIR, relative_path)) - Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: relative_path) - end - def rugged_from_gitaly(gitaly_repo) Rugged::Repository.new(repo_path_from_gitaly(gitaly_repo)) end @@ -96,21 +63,6 @@ module TestRepo File.join(DEFAULT_STORAGE_DIR, gitaly_repo.relative_path) end - def gitlab_git_from_gitaly(gitaly_repo) - Gitlab::Git::Repository.new( - gitaly_repo, - repo_path_from_gitaly(gitaly_repo), - 'project-123', - '' - ) - end - - def repository_from_relative_path(relative_path) - gitlab_git_from_gitaly( - Gitaly::Repository.new(storage_name: DEFAULT_STORAGE_NAME, relative_path: relative_path) - ) - end - def self.clone_new_repo!(origin, destination) env = {} env['GIT_EXEC_PATH'] = GIT_EXEC_PATH if defined?(GIT_EXEC_PATH) @@ -119,18 +71,6 @@ module TestRepo abort "Failed to clone test repo. Try running 'make prepare-tests' and try again." end - - def self.init_new_repo!(destination) - return if system(Gitlab.config.git.bin_path, "-c", "init.templateDir=", "init", "--quiet", "--bare", destination.to_s) - - abort "Failed to init test repo." - end - - private - - def random_repository_relative_path(prefix) - "#{prefix}-#{SecureRandom.hex(6)}.git" - end end TestRepo.prepare_test_repository |