diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-23 03:10:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-23 03:10:38 +0300 |
commit | a7698afc6e7a5a6e4e5044f5b310a2c69c554053 (patch) | |
tree | 5be1ccc63a64e7cd3decc9523ec8cbaa950db758 /spec/lib/api | |
parent | aaedbff77d0e656e9738322a59476bbb2fab8266 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/api')
-rw-r--r-- | spec/lib/api/entities/ml/mlflow/run_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/lib/api/entities/ml/mlflow/run_spec.rb b/spec/lib/api/entities/ml/mlflow/run_spec.rb index 5511861991e..b8d38093681 100644 --- a/spec/lib/api/entities/ml/mlflow/run_spec.rb +++ b/spec/lib/api/entities/ml/mlflow/run_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe API::Entities::Ml::Mlflow::Run do - let_it_be(:candidate) { create(:ml_candidates, :with_metrics) } + let_it_be(:candidate) { create(:ml_candidates, :with_metrics_and_params) } subject { described_class.new(candidate).as_json } @@ -29,6 +29,18 @@ RSpec.describe API::Entities::Ml::Mlflow::Run do expect(presented_metric[:step]).to eq(metric.step) end + it 'presents the params' do + expect(subject.dig(:run, :data, :params).size).to eq(candidate.params.size) + end + + it 'presents params correctly' do + presented_param = subject.dig(:run, :data, :params)[0] + param = candidate.params[0] + + expect(presented_param[:key]).to eq(param.name) + expect(presented_param[:value]).to eq(param.value) + end + context 'when candidate has no metrics' do before do allow(candidate).to receive(:metrics).and_return([]) @@ -38,4 +50,14 @@ RSpec.describe API::Entities::Ml::Mlflow::Run do expect(subject.dig(:run, :data, :metrics)).to be_empty end end + + context 'when candidate has no params' do + before do + allow(candidate).to receive(:params).and_return([]) + end + + it 'data is empty' do + expect(subject.dig(:run, :data, :params)).to be_empty + end + end end |