diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/services/ml/model_versions/update_model_version_service_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/services/ml/model_versions/update_model_version_service_spec.rb')
-rw-r--r-- | spec/services/ml/model_versions/update_model_version_service_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/services/ml/model_versions/update_model_version_service_spec.rb b/spec/services/ml/model_versions/update_model_version_service_spec.rb new file mode 100644 index 00000000000..99ea8b81df3 --- /dev/null +++ b/spec/services/ml/model_versions/update_model_version_service_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ml::ModelVersions::UpdateModelVersionService, feature_category: :mlops do + let_it_be(:existing_version) { create(:ml_model_versions) } + + let(:project) { existing_version.project } + let(:name) { existing_version.name } + let(:version) { existing_version.version } + let(:description) { 'A model version description' } + + subject(:execute_service) { described_class.new(project, name, version, description).execute } + + describe '#execute' do + context 'when model version exists' do + it { is_expected.to be_success } + + it 'updates the model version description' do + execute_service + + expect(execute_service.payload.description).to eq(description) + end + end + + context 'when description is invalid' do + let(:description) { 'a' * 501 } + + it { is_expected.to be_error } + end + + context 'when model does not exist' do + let(:name) { 'a_new_model' } + + it { is_expected.to be_error } + end + + context 'when model version does not exist' do + let(:name) { '2.0.0' } + + it { is_expected.to be_error } + end + end +end |