diff options
Diffstat (limited to 'app/models/ci/test_case.rb')
-rw-r--r-- | app/models/ci/test_case.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/app/models/ci/test_case.rb b/app/models/ci/test_case.rb deleted file mode 100644 index 19ecc177436..00000000000 --- a/app/models/ci/test_case.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -module Ci - class TestCase < ApplicationRecord - extend Gitlab::Ci::Model - - validates :project, :key_hash, presence: true - - has_many :test_case_failures, class_name: 'Ci::TestCaseFailure' - - belongs_to :project - - scope :by_project_and_keys, -> (project, keys) { where(project_id: project.id, key_hash: keys) } - - class << self - def find_or_create_by_batch(project, test_case_keys) - # Insert records first. Existing ones will be skipped. - insert_all(test_case_attrs(project, test_case_keys)) - - # Find all matching records now that we are sure they all are persisted. - by_project_and_keys(project, test_case_keys) - end - - private - - def test_case_attrs(project, test_case_keys) - # NOTE: Rails 6.1 will add support for insert_all on relation so that - # we will be able to do project.test_cases.insert_all. - test_case_keys.map do |hashed_key| - { project_id: project.id, key_hash: hashed_key } - end - end - end - end -end |