Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ml/experiment_spec.rb')
-rw-r--r--spec/models/ml/experiment_spec.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/models/ml/experiment_spec.rb b/spec/models/ml/experiment_spec.rb
index c75331a2ab5..9738a88b5b8 100644
--- a/spec/models/ml/experiment_spec.rb
+++ b/spec/models/ml/experiment_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Ml::Experiment do
+RSpec.describe Ml::Experiment, feature_category: :mlops do
let_it_be(:exp) { create(:ml_experiments) }
let_it_be(:exp2) { create(:ml_experiments, project: exp.project) }
@@ -16,6 +16,12 @@ RSpec.describe Ml::Experiment do
it { is_expected.to have_many(:metadata) }
end
+ describe '.package_name' do
+ describe '.package_name' do
+ it { expect(exp.package_name).to eq("ml_experiment_#{exp.iid}") }
+ end
+ end
+
describe '#by_project_id_and_iid' do
subject { described_class.by_project_id_and_iid(exp.project_id, iid) }
@@ -74,4 +80,22 @@ RSpec.describe Ml::Experiment do
expect(subject[exp3.id]).to eq(3)
end
end
+
+ describe '#package_for_experiment?' do
+ using RSpec::Parameterized::TableSyntax
+
+ subject { described_class.package_for_experiment?(package_name) }
+
+ where(:package_name, :id) do
+ 'ml_experiment_1234' | true
+ 'ml_experiment_1234abc' | false
+ 'ml_experiment_abc' | false
+ 'ml_experiment_' | false
+ 'blah' | false
+ end
+
+ with_them do
+ it { is_expected.to be(id) }
+ end
+ end
end