Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Commit 9e36c7e

Browse files
authored
Merge pull request #335 from zalando-stups/fix-334
Fixing #334 - Cert field not handled?
2 parents 7636a66 + 09649ca commit 9e36c7e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

senza/components/elastic_load_balancer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def get_ssl_cert(subdomain, main_zone, configuration, account_info: AccountArgum
7272
else:
7373
fatal_error('Could not find any SSL certificate')
7474

75+
return ssl_cert
76+
7577

7678
def get_listeners(subdomain, main_zone, configuration,
7779
account_info: AccountArguments):

tests/test_components.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,41 @@ def test_component_load_balancer_idletimeout(monkeypatch):
139139
assert 'HTTPPort' not in result["Resources"]["test_lb"]["Properties"]
140140

141141

142+
def test_component_load_balancer_cert_arn(monkeypatch):
143+
configuration = {
144+
"Name": "test_lb",
145+
"SecurityGroups": "",
146+
"HTTPPort": "9999",
147+
"SSLCertificateId": "foo2"
148+
}
149+
150+
info = {'StackName': 'foobar', 'StackVersion': '0.1'}
151+
definition = {"Resources": {}}
152+
153+
args = MagicMock()
154+
args.region = "foo"
155+
156+
mock_string_result = MagicMock()
157+
mock_string_result.return_value = "foo"
158+
monkeypatch.setattr('senza.components.elastic_load_balancer.resolve_security_groups', mock_string_result)
159+
160+
m_acm = MagicMock()
161+
m_acm_certificate = MagicMock()
162+
m_acm_certificate.arn = "foo"
163+
164+
m_acm.get_certificates.return_value = iter([m_acm_certificate])
165+
166+
m_acm_certificate.is_arn_certificate.return_value = True
167+
m_acm_certificate.get_by_arn.return_value = True
168+
169+
monkeypatch.setattr('senza.components.elastic_load_balancer.ACM', m_acm)
170+
monkeypatch.setattr('senza.components.elastic_load_balancer.ACMCertificate', m_acm_certificate)
171+
172+
# issue 105: support additional ELB properties
173+
result = component_elastic_load_balancer(definition, configuration, args, info, False, MagicMock())
174+
assert "foo2" == result["Resources"]["test_lb"]["Properties"]["Listeners"][0]["SSLCertificateId"]
175+
176+
142177
def test_component_load_balancer_http_only(monkeypatch):
143178
configuration = {
144179
"Name": "test_lb",

0 commit comments

Comments
 (0)