@@ -1645,6 +1645,43 @@ func (s HaProxyTestSuite) Test_CreateConfigFromTemplates_AddsContentFrontEndWith
16451645 s .Equal (expectedData , actualData )
16461646}
16471647
1648+ func (s HaProxyTestSuite ) Test_CreateConfigFromTemplates_AddsContentFrontEndWithDomain_Https () {
1649+ var actualData string
1650+ tmpl := s .TemplateContent
1651+ expectedData := fmt .Sprintf (
1652+ `%s
1653+ acl url_https_my-service-11111_0 path_beg /path
1654+ acl domain_https_my-service-11111_0 hdr_beg(host) -i domain-1-1 domain-1-2
1655+ use_backend https-my-service-1-be1111_0 if url_https_my-service-11111_0 domain_https_my-service-11111_0
1656+ acl url_https_my-service-21111_0 path_beg /path
1657+ acl domain_https_my-service-21111_0 hdr_beg(host) -i domain-2-1 domain-2-2
1658+ use_backend https-my-service-2-be1111_0 if url_https_my-service-21111_0 domain_https_my-service-21111_0%s` ,
1659+ tmpl ,
1660+ s .ServicesContent ,
1661+ )
1662+ writeFile = func (filename string , data []byte , perm os.FileMode ) error {
1663+ actualData = string (data )
1664+ return nil
1665+ }
1666+ p := NewHaProxy (s .TemplatesPath , s .ConfigsPath )
1667+ for i := 1 ; i <= 2 ; i ++ {
1668+ name := fmt .Sprintf ("my-service-%d" , i )
1669+ domain := fmt .Sprintf ("domain-%d" , i )
1670+ service := Service {
1671+ ServiceName : name ,
1672+ PathType : "path_beg" ,
1673+ ServiceDest : []ServiceDest {
1674+ {HttpsPort : 1111 , ServicePath : []string {"/path" }, ServiceDomain : []string {domain + "-1" , domain + "-2" }},
1675+ },
1676+ }
1677+ p .AddService (service )
1678+ }
1679+
1680+ p .CreateConfigFromTemplates ()
1681+
1682+ s .Equal (expectedData , actualData )
1683+ }
1684+
16481685func (s HaProxyTestSuite ) Test_CreateConfigFromTemplates_AddsDomainsForEachServiceDest () {
16491686 var actualData string
16501687 tmpl := s .TemplateContent
0 commit comments