diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-30 21:09:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-30 21:09:46 +0300 |
commit | ace0df53d3ed38344b470727d430484d24eeb798 (patch) | |
tree | ec1fc71d793bf3d588df9fe97c4649c87e697e73 /spec/serializers/rollout_status_entity_spec.rb | |
parent | 56eafa995d0bbda39bc24cd07537286bf36a4dd9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers/rollout_status_entity_spec.rb')
-rw-r--r-- | spec/serializers/rollout_status_entity_spec.rb | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/spec/serializers/rollout_status_entity_spec.rb b/spec/serializers/rollout_status_entity_spec.rb new file mode 100644 index 00000000000..7ad4b259bcd --- /dev/null +++ b/spec/serializers/rollout_status_entity_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe RolloutStatusEntity do + include KubernetesHelpers + + let(:rollout_status) { kube_deployment_rollout_status } + + let(:entity) do + described_class.new(rollout_status, request: double) + end + + subject { entity.as_json } + + it "exposes status" do + is_expected.to include(:status) + end + + it 'exposes has_legacy_app_label' do + is_expected.to include(:has_legacy_app_label) + end + + context 'when kube deployment is valid' do + it "exposes deployment data" do + is_expected.to include(:instances, :completion, :is_completed) + end + + it 'does not expose canary ingress if it does not exist' do + is_expected.not_to include(:canary_ingress) + end + + context 'when canary ingress exists' do + let(:rollout_status) { kube_deployment_rollout_status(ingresses: [kube_ingress(track: :canary)]) } + + it 'expose canary ingress' do + is_expected.to include(:canary_ingress) + end + end + end + + context 'when kube deployment is empty' do + let(:rollout_status) { empty_deployment_rollout_status } + + it "exposes status" do + is_expected.to include(:status) + end + + it "does not expose deployment data" do + is_expected.not_to include(:instances, :completion, :is_completed, :canary_ingress) + end + end +end |