2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Clusters::Applications::CheckIngressIpAddressService do
|
2018-11-08 19:23:39 +05:30
|
|
|
include ExclusiveLeaseHelpers
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
let(:application) { create(:clusters_applications_ingress, :installed) }
|
|
|
|
let(:service) { described_class.new(application) }
|
|
|
|
let(:kubeclient) { double(::Kubeclient::Client, get_service: kube_service) }
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:lease_key) { "check_ingress_ip_address_service:#{application.id}" }
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:ingress) do
|
|
|
|
[
|
|
|
|
{
|
|
|
|
ip: '111.222.111.222',
|
|
|
|
hostname: 'localhost.localdomain'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
let(:kube_service) do
|
|
|
|
::Kubeclient::Resource.new(
|
|
|
|
{
|
|
|
|
status: {
|
|
|
|
loadBalancer: {
|
|
|
|
ingress: ingress
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { service.execute }
|
|
|
|
|
|
|
|
before do
|
2018-11-08 19:23:39 +05:30
|
|
|
stub_exclusive_lease(lease_key, timeout: 15.seconds.to_i)
|
2018-03-27 19:54:05 +05:30
|
|
|
allow(application.cluster).to receive(:kubeclient).and_return(kubeclient)
|
|
|
|
end
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
include_examples 'check ingress ip executions', :clusters_applications_ingress
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
include_examples 'check ingress ip executions', :clusters_applications_knative
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|