debian-mirror-gitlab/spec/models/ci/runner_version_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.3 KiB
Ruby
Raw Normal View History

2022-08-13 15:12:31 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe Ci::RunnerVersion, feature_category: :runner_fleet do
let_it_be(:runner_version_recommended) do
create(:ci_runner_version, version: 'abc234', status: :recommended)
end
2022-08-13 15:12:31 +05:30
let_it_be(:runner_version_not_available) do
create(:ci_runner_version, version: 'abc123', status: :not_available)
end
2023-03-04 22:38:38 +05:30
it_behaves_like 'having unique enum values'
2022-08-13 15:12:31 +05:30
describe '.not_available' do
subject { described_class.not_available }
it { is_expected.to match_array([runner_version_not_available]) }
end
describe '.potentially_outdated' do
subject { described_class.potentially_outdated }
let_it_be(:runner_version_nil) { create(:ci_runner_version, version: 'abc345', status: nil) }
let_it_be(:runner_version_available) do
create(:ci_runner_version, version: 'abc456', status: :available)
end
2022-08-27 11:52:29 +05:30
it 'contains any valid or unprocessed runner version that is not already recommended' do
2023-03-04 22:38:38 +05:30
is_expected.to match_array(
[runner_version_nil, runner_version_not_available, runner_version_available]
)
2022-08-13 15:12:31 +05:30
end
end
describe 'validation' do
context 'when runner version is too long' do
let(:runner_version) { build(:ci_runner_version, version: 'a' * 2049) }
it 'is not valid' do
expect(runner_version).to be_invalid
end
end
end
end