debian-mirror-gitlab/spec/lib/gitlab/kubernetes/ingress_spec.rb

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

58 lines
1.1 KiB
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Kubernetes::Ingress do
include KubernetesHelpers
let(:ingress) { described_class.new(params) }
describe '#canary?' do
subject { ingress.canary? }
context 'with canary ingress parameters' do
let(:params) { canary_metadata }
it { is_expected.to be_truthy }
end
context 'with stable ingress parameters' do
let(:params) { stable_metadata }
it { is_expected.to be_falsey }
end
end
describe '#canary_weight' do
subject { ingress.canary_weight }
context 'with canary ingress parameters' do
let(:params) { canary_metadata }
it { is_expected.to eq(50) }
end
context 'with stable ingress parameters' do
let(:params) { stable_metadata }
it { is_expected.to be_nil }
end
end
describe '#name' do
subject { ingress.name }
let(:params) { stable_metadata }
it { is_expected.to eq('production-auto-deploy') }
end
def stable_metadata
kube_ingress(track: :stable)
end
def canary_metadata
kube_ingress(track: :canary)
end
end