debian-mirror-gitlab/spec/graphql/resolvers/ci/runner_status_resolver_spec.rb

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

53 lines
1.4 KiB
Ruby
Raw Normal View History

2022-01-26 12:08:38 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe Resolvers::Ci::RunnerStatusResolver, feature_category: :runner_fleet do
2022-01-26 12:08:38 +05:30
include GraphqlHelpers
describe '#resolve' do
let(:user) { build(:user) }
let(:runner) { build(:ci_runner) }
subject(:resolve_subject) { resolve(described_class, ctx: { current_user: user }, obj: runner, args: args) }
context 'with legacy_mode' do
context 'set to 14.5' do
let(:args) do
{ legacy_mode: '14.5' }
end
2023-06-20 00:43:36 +05:30
it 'calls runner.status with nil' do
expect(runner).to receive(:status).with(nil).once.and_return(:stale)
expect(resolve_subject).to eq(:stale)
end
context 'when disable_runner_graphql_legacy_mode feature is disabled' do
before do
stub_feature_flags(disable_runner_graphql_legacy_mode: false)
end
it 'calls runner.status with specified legacy_mode' do
expect(runner).to receive(:status).with('14.5').once.and_return(:online)
2022-01-26 12:08:38 +05:30
2023-06-20 00:43:36 +05:30
expect(resolve_subject).to eq(:online)
end
2022-01-26 12:08:38 +05:30
end
end
context 'set to nil' do
let(:args) do
{ legacy_mode: nil }
end
2023-06-20 00:43:36 +05:30
it 'calls runner.status with nil' do
2022-01-26 12:08:38 +05:30
expect(runner).to receive(:status).with(nil).once.and_return(:stale)
expect(resolve_subject).to eq(:stale)
end
end
end
end
end