diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-20 06:14:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-20 06:14:16 +0300 |
commit | 602b7079493074b56bd024fd04afbdb8f729fc2f (patch) | |
tree | 0da123356cabcc10b9c36f404179197df8a235cb /spec/services/ml/model_versions | |
parent | aac72676438d00eca8f58aefb673e03af8c6c04b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/ml/model_versions')
-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 |