diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-26 03:08:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-26 03:08:57 +0300 |
commit | b8fcf7c3d6c3b48e59e6aae5b1a6b536bba8ac40 (patch) | |
tree | 947b357adb3c1b51f2fb7ec761a7d9a35c260e28 /spec/finders | |
parent | 5edc7a04de12237658e7149385661aede45d681c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/projects/ml/model_finder_spec.rb | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/spec/finders/projects/ml/model_finder_spec.rb b/spec/finders/projects/ml/model_finder_spec.rb index 386d690a8d2..48333ae49e5 100644 --- a/spec/finders/projects/ml/model_finder_spec.rb +++ b/spec/finders/projects/ml/model_finder_spec.rb @@ -3,38 +3,23 @@ require 'spec_helper' RSpec.describe Projects::Ml::ModelFinder, feature_category: :mlops do - let_it_be(:model1_a) { create(:ml_model_package) } - let_it_be(:project) { model1_a.project } - let_it_be(:model1_b) do - create(:ml_model_package, name: model1_a.name, project: project) - end - - let_it_be(:model2) do - create(:ml_model_package, status: :pending_destruction, project: project) - end - - let_it_be(:model3) { create(:ml_model_package) } - let_it_be(:model4) { create(:generic_package, project: project) } + let_it_be(:project) { create(:project) } + let_it_be(:model1) { create(:ml_models, :with_versions, project: project) } + let_it_be(:model2) { create(:ml_models, :with_versions, project: project) } + let_it_be(:model3) { create(:ml_models) } - subject { described_class.new(project).execute.to_a } + subject(:models) { described_class.new(project).execute.to_a } - it 'returns the most recent version of a model' do - is_expected.to include(model1_b) + it 'returns models for project' do + is_expected.to match_array([model1, model2]) end - it 'does not return older versions of a model' do - is_expected.not_to include(model1_a) - end - - it 'does not return models pending destruction' do - is_expected.not_to include(model2) + it 'including the latest version', :aggregate_failures do + expect(models[0].association_cached?(:latest_version)).to be(true) + expect(models[1].association_cached?(:latest_version)).to be(true) end it 'does not return models belonging to a different project' do is_expected.not_to include(model3) end - - it 'does not return packages that are not ml_model' do - is_expected.not_to include(model4) - end end |