2017-11-07 09:10:40 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe Clusters::Applications::Ingress do
|
|
|
|
it { is_expected.to belong_to(:cluster) }
|
|
|
|
it { is_expected.to validate_presence_of(:cluster) }
|
|
|
|
|
2018-02-19 20:42:05 -05:00
|
|
|
before do
|
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
|
2018-02-22 17:08:12 -05:00
|
|
|
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
|
2018-02-19 20:42:05 -05:00
|
|
|
end
|
2018-02-11 22:22:15 -05:00
|
|
|
|
2018-02-19 20:42:05 -05:00
|
|
|
include_examples 'cluster application specs', described_class
|
2018-02-11 22:22:15 -05:00
|
|
|
|
2018-02-19 20:42:05 -05:00
|
|
|
describe '#make_installed!' do
|
2018-02-11 22:22:15 -05:00
|
|
|
before do
|
2018-02-19 20:42:05 -05:00
|
|
|
application.make_installed!
|
2018-02-11 22:22:15 -05:00
|
|
|
end
|
|
|
|
|
2018-02-19 20:42:05 -05:00
|
|
|
let(:application) { create(:clusters_applications_ingress, :installing) }
|
|
|
|
|
2018-02-11 22:22:15 -05:00
|
|
|
it 'schedules a ClusterWaitForIngressIpAddressWorker' do
|
|
|
|
expect(ClusterWaitForIngressIpAddressWorker).to have_received(:perform_in)
|
|
|
|
.with(ClusterWaitForIngressIpAddressWorker::INTERVAL, 'ingress', application.id, 3)
|
|
|
|
end
|
|
|
|
end
|
2018-02-19 21:49:35 -05:00
|
|
|
|
2018-02-22 17:08:12 -05:00
|
|
|
describe '#schedule_status_update' do
|
2018-02-19 21:49:35 -05:00
|
|
|
let(:application) { create(:clusters_applications_ingress, :installed) }
|
|
|
|
|
|
|
|
before do
|
2018-02-22 17:08:12 -05:00
|
|
|
application.schedule_status_update
|
2018-02-19 21:49:35 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'schedules a ClusterWaitForIngressIpAddressWorker' do
|
2018-02-22 17:08:12 -05:00
|
|
|
expect(ClusterWaitForIngressIpAddressWorker).to have_received(:perform_async)
|
|
|
|
.with('ingress', application.id, 3)
|
2018-02-19 21:49:35 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when the application is not installed' do
|
|
|
|
let(:application) { create(:clusters_applications_ingress, :installing) }
|
|
|
|
|
|
|
|
it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do
|
2018-02-22 17:08:12 -05:00
|
|
|
expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_async)
|
2018-02-19 21:49:35 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is already an external_ip' do
|
|
|
|
let(:application) { create(:clusters_applications_ingress, :installed, external_ip: '111.222.222.111') }
|
|
|
|
|
|
|
|
it 'does not schedule a ClusterWaitForIngressIpAddressWorker' do
|
|
|
|
expect(ClusterWaitForIngressIpAddressWorker).not_to have_received(:perform_in)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-11-07 09:10:40 -05:00
|
|
|
end
|