Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Add unit test for environment variable HAPROXY templates
Browse files Browse the repository at this point in the history
  • Loading branch information
justinrlee committed Sep 21, 2017
1 parent 1bb98eb commit bbf89cd
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_marathon_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,38 @@ def test_config_no_apps(self):
bind *:9091
mode http
frontend marathon_https_in
bind *:443 ssl crt /etc/ssl/cert.pem
mode http
'''
print("actual config:\n")
print(config)
self.assertMultiLineEqual(config, expected)

def test_config_env_template(self):
apps = dict()
groups = ['external']
bind_http_https = True
ssl_certs = ""
os.environ["HAPROXY_HTTP_FRONTEND_HEAD"] = '''
frontend changed_frontend
bind *:80
mode http
'''
templater = marathon_lb.ConfigTemplater()
del os.environ["HAPROXY_HTTP_FRONTEND_HEAD"]

config = marathon_lb.config(apps, groups, bind_http_https,
ssl_certs, templater)
expected = self.base_config + '''
frontend changed_frontend
bind *:80
mode http
frontend marathon_http_appid_in
bind *:9091
mode http
frontend marathon_https_in
bind *:443 ssl crt /etc/ssl/cert.pem
mode http
Expand Down

0 comments on commit bbf89cd

Please sign in to comment.