summaryrefslogtreecommitdiff
path: root/spec/models/ml
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-09 15:17:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-09 15:17:20 +0000
commit3670ddd229b178c0a2e09a1466ddfd7fd2f7855d (patch)
tree9be2a8155e0b14fb9a07b6a1c8bcfa629af4a25c /spec/models/ml
parent0b4adad74b76b34855e9a6d943f9b9188c3914fa (diff)
downloadgitlab-ce-3670ddd229b178c0a2e09a1466ddfd7fd2f7855d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ml')
-rw-r--r--spec/models/ml/candidate_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/models/ml/candidate_spec.rb b/spec/models/ml/candidate_spec.rb
index a39babd78b7..fa19b723ee2 100644
--- a/spec/models/ml/candidate_spec.rb
+++ b/spec/models/ml/candidate_spec.rb
@@ -157,6 +157,9 @@ RSpec.describe Ml::Candidate, factory_default: :keep, feature_category: :mlops d
expect(subject.association_cached?(:latest_metrics)).to be(true)
expect(subject.association_cached?(:params)).to be(true)
expect(subject.association_cached?(:user)).to be(true)
+ expect(subject.association_cached?(:project)).to be(true)
+ expect(subject.association_cached?(:package)).to be(true)
+ expect(subject.association_cached?(:ci_build)).to be(true)
end
end
@@ -188,6 +191,22 @@ RSpec.describe Ml::Candidate, factory_default: :keep, feature_category: :mlops d
end
end
+ describe 'from_ci?' do
+ subject { candidate }
+
+ it 'is false if candidate does not have ci_build_id' do
+ allow(candidate).to receive(:ci_build_id).and_return(nil)
+
+ is_expected.not_to be_from_ci
+ end
+
+ it 'is true if candidate does has ci_build_id' do
+ allow(candidate).to receive(:ci_build_id).and_return(1)
+
+ is_expected.to be_from_ci
+ end
+ end
+
describe '#order_by_metric' do
let_it_be(:auc_metrics) do
create(:ml_candidate_metrics, name: 'auc', value: 0.4, candidate: candidate)