blob: 9f0d55329ada71e1b82d95e2fb6eb7f9f7c836ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# frozen_string_literal: true
module Ci
module Partitionable
module Testing
InclusionError = Class.new(StandardError)
PARTITIONABLE_MODELS = %w[
CommitStatus
Ci::BuildMetadata
Ci::BuildNeed
Ci::BuildReportResult
Ci::BuildRunnerSession
Ci::BuildTraceChunk
Ci::BuildTraceMetadata
Ci::BuildPendingState
Ci::JobAnnotation
Ci::JobArtifact
Ci::JobVariable
Ci::Pipeline
Ci::PendingBuild
Ci::RunningBuild
Ci::RunnerManagerBuild
Ci::PipelineArtifact
Ci::PipelineChatData
Ci::PipelineConfig
Ci::PipelineMetadata
Ci::PipelineVariable
Ci::Sources::Pipeline
Ci::Stage
Ci::UnitTestFailure
].freeze
def self.check_inclusion(klass)
return if partitionable_models.include?(klass.name)
raise Partitionable::Testing::InclusionError,
"#{klass} must be included in PARTITIONABLE_MODELS"
rescue InclusionError => e
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e)
end
def self.partitionable_models
PARTITIONABLE_MODELS
end
end
end
end
Ci::Partitionable::Testing.prepend_mod
|