diff options
Diffstat (limited to 'spec/services/ml/find_or_create_model_version_service_spec.rb')
-rw-r--r-- | spec/services/ml/find_or_create_model_version_service_spec.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/services/ml/find_or_create_model_version_service_spec.rb b/spec/services/ml/find_or_create_model_version_service_spec.rb index 1211a9b1165..e5ca7c3a450 100644 --- a/spec/services/ml/find_or_create_model_version_service_spec.rb +++ b/spec/services/ml/find_or_create_model_version_service_spec.rb @@ -5,14 +5,18 @@ require 'spec_helper' RSpec.describe ::Ml::FindOrCreateModelVersionService, feature_category: :mlops do let_it_be(:existing_version) { create(:ml_model_versions) } let_it_be(:another_project) { create(:project) } + let_it_be(:user) { create(:user) } let(:package) { nil } + let(:description) { nil } let(:params) do { model_name: name, version: version, - package: package + package: package, + description: description, + user: user } end @@ -26,6 +30,7 @@ RSpec.describe ::Ml::FindOrCreateModelVersionService, feature_category: :mlops d it 'returns existing model version', :aggregate_failures do expect { model_version }.to change { Ml::ModelVersion.count }.by(0) + expect { model_version }.to change { Ml::Candidate.count }.by(0) expect(model_version).to eq(existing_version) end end @@ -34,15 +39,18 @@ RSpec.describe ::Ml::FindOrCreateModelVersionService, feature_category: :mlops d let(:project) { existing_version.project } let(:name) { 'a_new_model' } let(:version) { '2.0.0' } + let(:description) { 'A model version' } let(:package) { create(:ml_model_package, project: project, name: name, version: version) } it 'creates a new model version', :aggregate_failures do - expect { model_version }.to change { Ml::ModelVersion.count } + expect { model_version }.to change { Ml::ModelVersion.count }.by(1).and change { Ml::Candidate.count }.by(1) expect(model_version.name).to eq(name) expect(model_version.version).to eq(version) expect(model_version.package).to eq(package) + expect(model_version.candidate.model_version_id).to eq(model_version.id) + expect(model_version.description).to eq(description) end end end |