File tree Expand file tree Collapse file tree 4 files changed +81
-3
lines changed
cf-common-test/tests/deployment Expand file tree Collapse file tree 4 files changed +81
-3
lines changed Original file line number Diff line number Diff line change 1+ # yaml-language-server: $schema=https://raw.githubusercontent.com/quintush/helm-unittest/master/schema/helm-testsuite.json
2+ suite : classic connection Uri
3+ templates :
4+ - templates/deployment.yaml
5+ tests :
6+ - it : Test External RabbitMQ connection Uri
7+ values :
8+ - values.yaml
9+ set :
10+ global :
11+ rabbitmqUsername : username
12+ rabbitmqPassword : password
13+ rabbitmqProtocol : amqps
14+ rabbitmqHostname : hostname.domain:5671
15+ rabbitmq :
16+ enabled : false
17+ container :
18+ env :
19+ RABBIT_URL : ' {{ include "cf-common.classic.calculateRabbitMqUri" . }}'
20+ asserts :
21+ - contains :
22+ path : spec.template.spec.containers[0].env
23+ content :
24+ name : RABBIT_URL
25+ value : " amqps://username:password@hostname.domain:5671"
26+
27+ - it : Test Internal RabbitMQ connection Uri
28+ release :
29+ name : cf
30+ values :
31+ - values.yaml
32+ set :
33+ global :
34+ rabbitmqService : rabbitmq
35+ rabbitmq :
36+ enabled : true
37+ auth :
38+ username : user
39+ password : pass
40+ container :
41+ env :
42+ RABBIT_URL : ' {{ include "cf-common.classic.calculateRabbitMqUri" . }}'
43+ asserts :
44+ - contains :
45+ path : spec.template.spec.containers[0].env
46+ content :
47+ name : RABBIT_URL
48+ value : " amqp://user:pass@cf-rabbitmq"
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ apiVersion: v2
22appVersion : v0.0.0
33description : Codefresh library chart
44name : cf-common
5- version : 0.0.2
5+ version : 0.0.3
66type : library
77keywords :
88 - codefresh
Original file line number Diff line number Diff line change 22
33Codefresh library chart
44
5- ![ Version: 0.0.2 ] ( https://img.shields.io/badge/Version-0.0.2 -informational?style=flat-square ) ![ Type: library] ( https://img.shields.io/badge/Type-library-informational?style=flat-square ) ![ AppVersion: v0.0.0] ( https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square )
5+ ![ Version: 0.0.3 ] ( https://img.shields.io/badge/Version-0.0.3 -informational?style=flat-square ) ![ Type: library] ( https://img.shields.io/badge/Type-library-informational?style=flat-square ) ![ AppVersion: v0.0.0] ( https://img.shields.io/badge/AppVersion-v0.0.0-informational?style=flat-square )
66
77## Installing the Chart
88
@@ -18,7 +18,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
1818# Chart.yaml
1919dependencies :
2020- name : cf-common
21- version : 0.0.2
21+ version : 0.0.3
2222 repository : https://chartmuseum.codefresh.io/cf-common
2323` ` `
2424
Original file line number Diff line number Diff line change 1+ { {/*
2+ Calculate RabbitMQ URI
3+ Usage
4+ {{ include " cf-common.classic.calculateRabbitMqUri" . } }
5+ */}}
6+
7+ { {- define " cf-common.classic.calculateRabbitMqUri" } }
8+
9+ { {- $rabbitmqProtocol := $.Values.global.rabbitmqProtocol | default " amqp" -} }
10+ { {- $rabbitmqUsername := .Values.global.rabbitmqUsername -} }
11+ { {- $rabbitmqPassword := .Values.global.rabbitmqPassword -} }
12+
13+ { {- /*
14+ If built-in bitnami/rabbitmq chart enabled get username/password there
15+ */} }
16+ { {- if $.Values.rabbitmq } }
17+ { {- if $.Values.rabbitmq.enabled } }
18+ { {- $rabbitmqUsername = .Values.rabbitmq.auth.username -} }
19+ { {- $rabbitmqPassword = .Values.rabbitmq.auth.password -} }
20+ { {- end } }
21+ { {- end } }
22+
23+ { {- /*
24+ coalesce here for backward compatibility
25+ */} }
26+ { {- $rabbitmqHostname := .Values.global.rabbitmqHostname | default (printf " %s-%s" .Release.Name (coalesce .Values.global.rabbitService .Values.global.rabbitmqService ) ) -} }
27+
28+ { {- printf " %s://%s:%s@%s" $rabbitmqProtocol $rabbitmqUsername $rabbitmqPassword $rabbitmqHostname -} }
29+
30+ { {- end } }
You can’t perform that action at this time.
0 commit comments