#NEWLINE# def test_config_simple_app_multiple_vhost_with_path_and_auth( self ) : #NEWLINE# #INDENT# apps = dict ( ) #NEWLINE# groups = [ 'external' ] #NEWLINE# bind_http_https = True #NEWLINE# ssl_certs = '' #NEWLINE# templater = marathon_lb . ConfigTemplater ( ) #NEWLINE# healthCheck = { #NEWLINE# #INDENT# 'path' : '/' , #NEWLINE# 'protocol' : 'HTTP' , #NEWLINE# 'portIndex' : 0 , #NEWLINE# 'gracePeriodSeconds' : 10 , #NEWLINE# 'intervalSeconds' : 2 , #NEWLINE# 'timeoutSeconds' : 10 , #NEWLINE# 'maxConsecutiveFailures' : 10 , #NEWLINE# 'ignoreHttp1xx' : False , #NEWLINE# #UNINDENT# } #NEWLINE# app = marathon_lb . MarathonService ( '/nginx' , 10000 , healthCheck ) #NEWLINE# app . hostname = 'test.example.com,test' #NEWLINE# app . path = '/some/path' #NEWLINE# app . groups = [ 'external' ] #NEWLINE# app . authRealm = 'realm' #NEWLINE# app . authUser = 'testuser' #NEWLINE# app . authPasswd = 'testpasswd' #NEWLINE# apps = [ app ] #NEWLINE# config = marathon_lb . config ( apps , healthCheck , bind_http_https , ssl_certs , templater ) #NEWLINE# expected = ( ( self . base_config + '\nuserlist user_nginx_10000\n  user testuser password testpasswd\n\nfrontend marathon_http_in\n  bind *:80\n  mode http\n  acl path_nginx_10000 path_beg /some/path\n  acl auth_test_example_com_nginx http_auth(user_nginx_10000)\n  acl host_test_example_com_nginx hdr(host) -i test.example.com\n  acl host_test_example_com_nginx hdr(host) -i test\n  http-request auth realm "realm" if host_test_example_com_nginx path_nginx_10000 !auth_test_example_com_nginx\n  use_backend nginx_10000 if host_test_example_com_nginx path_nginx_10000\n\nfrontend marathon_http_appid_in\n  bind *:9091\n  mode http\n  acl app__nginx hdr(x-marathon-app-id) -i /nginx\n  use_backend nginx_10000 if app__nginx\n\nfrontend marathon_https_in\n  bind *:443 ssl crt /etc/ssl/mesosphere.com.pem\n  mode http\n  acl path_nginx_10000 path_beg /some/path\n  acl auth_test_example_com_nginx http_auth(user_nginx_10000)\n  http-request auth realm "realm" if { ssl_fc_sni test.example.com } path_nginx_10000 !auth_test_example_com_nginx\n  use_backend nginx_10000 if { ssl_fc_sni test.example.com } ' ) + 'path_nginx_10000\n  acl auth_test_example_com_nginx http_auth(user_nginx_10000)\n  http-request auth realm "realm" if { ssl_fc_sni test } path_nginx_10000 !auth_test_example_com_nginx\n  use_backend nginx_10000 if { ssl_fc_sni test } path_nginx_10000\n\nfrontend nginx_10000\n  bind *:10000\n  mode http\n  use_backend nginx_10000\n\nbackend nginx_10000\n  balance roundrobin\n  mode http\n  option forwardfor\n  http-request set-header X-Forwarded-Port %[dst_port]\n  http-request add-header X-Forwarded-Proto https if { ssl_fc }\n  option  httpchk GET /\n  timeout check 10s\n' ) #NEWLINE# self . assertMultiLineEqual ( config , expected )