Skip to content
Snippets Groups Projects
Commit f149c6b4 authored by Aakriti Gupta's avatar Aakriti Gupta
Browse files

Fix variable name used for --skip-preflight-check option

parent 7f30b17c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -34,7 +34,7 @@ def get_ctl_options
options[:confirm_removing_keys] = c
end
 
opts.on('-m', '--skip-preflight-checks', 'Do not ask for confirmation if manual checks ran') do |c|
opts.on('-m', '--skip-preflight-checks', 'Do not ask for confirmation if manual checks ran') do |m|
options[:skip_preflight_checks] = m
end
end.parse!(ARGV.dup)
Loading
Loading
# frozen_string_literal: true
require 'spec_helper'
require 'geo/promote_to_primary_node'
 
describe 'gitlab-ctl promote-to-primary-node' do
include_examples 'gitlab geo commands',
'promote-to-primary-node',
Geo::PromoteToPrimaryNode,
'promote_to_primary_node'
let(:klass) { Geo::PromoteToPrimaryNode }
let(:command_name) { 'promote-to-primary-node' }
let(:command_script) { 'promote_to_primary_node' }
include_context 'ctl'
it_behaves_like 'gitlab geo promotion commands', 'promote-to-primary-node'
it_behaves_like 'geo promotion command accepts option',
'--confirm-primary-is-down',
{ confirm_primary_is_down: true }
it_behaves_like 'geo promotion command accepts option',
'--confirm-removing-keys',
{ confirm_removing_keys: true }
it_behaves_like 'geo promotion command accepts option',
'--skip-preflight-checks',
{ skip_preflight_checks: true }
end
require 'spec_helper'
require 'geo/promotion_preflight_checks'
 
RSpec.shared_context 'promotion-preflight-checks' do
let(:command_name) { 'promotion-preflight-checks' }
let(:klass) { Geo::PromotionPreflightChecks }
let(:command_script) { 'promotion_preflight_checks' }
end
describe 'gitlab-ctl promotion-preflight-checks' do
include_examples 'gitlab geo commands',
'promotion-preflight-checks',
Geo::PromotionPreflightChecks,
'promotion_preflight_checks'
include_context 'promotion-preflight-checks'
include_context 'ctl'
it_behaves_like 'gitlab geo promotion commands'
end
require 'spec_helper'
require 'omnibus-ctl'
 
RSpec.shared_examples 'gitlab geo commands' do |command_name, klass, command_script|
subject(:ctl) { Omnibus::Ctl.new('testing-ctl') }
RSpec.shared_context 'ctl' do
let(:ctl) { Omnibus::Ctl.new('testing-ctl') }
before do
allow_any_instance_of(Omnibus::Ctl).to receive(:require).and_call_original
allow_any_instance_of(Omnibus::Ctl).to receive(:require).with(
Loading
Loading
@@ -14,21 +13,4 @@ RSpec.shared_examples 'gitlab geo commands' do |command_name, klass, command_scr
 
ctl.load_file("files/gitlab-ctl-commands-ee/#{command_script}.rb")
end
it 'appends a geo replication command' do
expect(subject.get_all_commands_hash).to include(command_name)
end
it 'executes the command when called' do
# ARGV contains the commands that were passed to rspec, which are
# invalid for the omnibus-ctl commands
oldargv = ARGV
ARGV = [] # rubocop:disable Style/MutableConstant
expect_any_instance_of(klass).to receive(:execute)
ctl.send(command_script)
ARGV = oldargv
end
end
require 'spec_helper'
RSpec.shared_examples 'geo promotion command accepts option' do |passed_option, expected_option|
it 'accepts given option' do
allow_any_instance_of(klass).to receive(:execute).and_return(true)
# ARGV contains the commands that were passed to rspec, which are
# invalid for the omnibus-ctl commands
oldargv = ARGV
ARGV = [passed_option] # rubocop:disable Style/MutableConstant
expect(klass).to receive(:new).with(
anything, expected_option).and_call_original
ctl.send(command_script, ARGV)
ARGV = oldargv
end
end
require 'spec_helper'
RSpec.shared_examples 'gitlab geo promotion commands' do
it 'appends a geo replication command' do
expect(ctl.get_all_commands_hash).to include(command_name)
end
it 'executes the command when called' do
# ARGV contains the commands that were passed to rspec, which are
# invalid for the omnibus-ctl commands
oldargv = ARGV
ARGV = [] # rubocop:disable Style/MutableConstant
expect_any_instance_of(klass).to receive(:execute)
ctl.send(command_script)
ARGV = oldargv
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment