|
| 1 | +# frozen_string_literal: true |
| 2 | +require 'spec_helper' |
| 3 | + |
| 4 | +describe 'imagePullSecrets configuration' do |
| 5 | + let(:template) { HelmTemplate.new(default_values) } |
| 6 | + |
| 7 | + context 'when setting custom workers' do |
| 8 | + let(:default_values) do |
| 9 | + HelmTemplate.with_defaults(<<~YAML |
| 10 | + workers: |
| 11 | + default: |
| 12 | + queues: "" |
| 13 | + replicaCount: 1 |
| 14 | + strategy: |
| 15 | + type: "Recreate" |
| 16 | + multitenancy: |
| 17 | + queues: "multitenancy" |
| 18 | + replicaCount: 1 |
| 19 | + strategy: |
| 20 | + type: "Recreate" |
| 21 | + bim: |
| 22 | + queues: "bim,ifc_conversion" |
| 23 | + replicaCount: 0 |
| 24 | + strategy: |
| 25 | + type: "Recreate" |
| 26 | + YAML |
| 27 | + ) |
| 28 | + end |
| 29 | + |
| 30 | + it 'Creates the different worker deployments', :aggregate_failures do |
| 31 | + expect(template.keys).to include 'Deployment/optest-openproject-worker-default' |
| 32 | + expect(template.dig('Deployment/optest-openproject-worker-default', 'spec', 'replicas')) |
| 33 | + .to eq(1) |
| 34 | + expect(template.env('Deployment/optest-openproject-worker-default', 'openproject', 'QUEUE')) |
| 35 | + .to be_nil |
| 36 | + |
| 37 | + expect(template.keys).to include 'Deployment/optest-openproject-worker-multitenancy' |
| 38 | + expect(template.dig('Deployment/optest-openproject-worker-multitenancy', 'spec', 'replicas')) |
| 39 | + .to eq(1) |
| 40 | + expect(template.env_named('Deployment/optest-openproject-worker-multitenancy', 'openproject', 'QUEUE')['value']) |
| 41 | + .to eq('multitenancy') |
| 42 | + |
| 43 | + expect(template.keys).to include 'Deployment/optest-openproject-worker-bim' |
| 44 | + expect(template.dig('Deployment/optest-openproject-worker-bim', 'spec', 'replicas')) |
| 45 | + .to eq(0) |
| 46 | + expect(template.env_named('Deployment/optest-openproject-worker-bim', 'openproject', 'QUEUE')['value']) |
| 47 | + .to eq('bim,ifc_conversion') |
| 48 | + end |
| 49 | + end |
| 50 | + |
| 51 | + context 'when setting no workers' do |
| 52 | + let(:default_values) do |
| 53 | + {} |
| 54 | + end |
| 55 | + |
| 56 | + it 'Creates the default worker', :aggregate_failures do |
| 57 | + expect(template.keys).to include 'Deployment/optest-openproject-worker-default' |
| 58 | + end |
| 59 | + end |
| 60 | +end |
0 commit comments