8
8
"encoding/json"
9
9
"io"
10
10
"path"
11
- "regexp"
12
11
"strings"
13
12
"sync"
14
13
"testing"
@@ -33,17 +32,17 @@ func TestDomainMultipleProjectSupport(t *testing.T) {
33
32
PublicFqdn string
34
33
PrivateFqdn string
35
34
}{
36
- {"tenant1" , "tenant1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.tenant1.internal" },
37
- {"tenant1" , "tenant1" , "web" , hostModePort , `web\ .tenant1.internal:80` , `web.[0-9a-z]{12} .example\ .com` , "web.tenant1.internal" },
38
- {"project1" , "tenant1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.project1.internal" },
39
- {"Project1" , "tenant1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.project1.internal" },
40
- {"project1" , "tenant1" , "web" , hostModePort , `web\ .project1\ .internal:80` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.project1.internal" },
41
- {"project1" , "tenant1" , "api" , port8080 , `api--8080\.[0-9a-z]{12}\ .example\ .com` , `api\.[0-9a-z]{12}\ .example\ .com` , "api.project1.internal" },
42
- {"tenant1" , "tenant1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.tenant1.internal" },
43
- {"tenant1" , "tenant1" , "web" , hostModePort , `web\ .tenant1\ .internal:80` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.tenant1.internal" },
44
- {"Project1" , "tenant1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.project1.internal" },
45
- {"Tenant2" , "tenant1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.tenant2.internal" },
46
- {"tenant1" , "tenAnt1" , "web" , port80 , `web--80\.[0-9a-z]{12}\ .example\ .com` , `web\.[0-9a-z]{12}\ .example\ .com` , "web.tenant1.internal" },
35
+ {"tenant1" , "tenant1" , "web" , port80 , `web--80.hrdsvwhcn3jj .example.com` , `web.hrdsvwhcn3jj .example.com` , "web.tenant1.internal" },
36
+ {"tenant1" , "tenant1" , "web" , hostModePort , `web.tenant1.internal:80` , `web.hrdsvwhcn3jj .example.com` , "web.tenant1.internal" },
37
+ {"project1" , "tenant1" , "web" , port80 , `web--80.b9vgnfzbeoeu .example.com` , `web.b9vgnfzbeoeu .example.com` , "web.project1.internal" },
38
+ {"Project1" , "tenant1" , "web" , port80 , `web--80.cr8i4dwuk1vs .example.com` , `web.cr8i4dwuk1vs .example.com` , "web.project1.internal" },
39
+ {"project1" , "tenant1" , "web" , hostModePort , `web.project1.internal:80` , `web.b9vgnfzbeoeu .example.com` , "web.project1.internal" },
40
+ {"project1" , "tenant1" , "api" , port8080 , `api--8080.b9vgnfzbeoeu .example.com` , `api.b9vgnfzbeoeu .example.com` , "api.project1.internal" },
41
+ {"tenant1" , "tenant1" , "web" , port80 , `web--80.hrdsvwhcn3jj .example.com` , `web.hrdsvwhcn3jj .example.com` , "web.tenant1.internal" },
42
+ {"tenant1" , "tenant1" , "web" , hostModePort , `web.tenant1.internal:80` , `web.hrdsvwhcn3jj .example.com` , "web.tenant1.internal" },
43
+ {"Project1" , "tenant1" , "web" , port80 , `web--80.cr8i4dwuk1vs .example.com` , `web.cr8i4dwuk1vs .example.com` , "web.project1.internal" },
44
+ {"Tenant2" , "tenant1" , "web" , port80 , `web--80.wsm43awbq8pw .example.com` , `web.wsm43awbq8pw .example.com` , "web.tenant2.internal" },
45
+ {"tenant1" , "tenAnt1" , "web" , port80 , `web--80.b63ocx2b6o4t .example.com` , `web.b63ocx2b6o4t .example.com` , "web.tenant1.internal" },
47
46
}
48
47
49
48
for _ , tt := range tests {
@@ -56,12 +55,12 @@ func TestDomainMultipleProjectSupport(t *testing.T) {
56
55
b .ProjectDomain = b .getProjectDomain ("123456789012" , "example.com" )
57
56
58
57
endpoint := b .getEndpoint (tt .Fqn , tt .Port )
59
- if ! regexp . MustCompile ( tt .EndPoint ). MatchString ( endpoint ) {
58
+ if tt .EndPoint != endpoint {
60
59
t .Errorf ("expected endpoint %q, got %q" , tt .EndPoint , endpoint )
61
60
}
62
61
63
62
publicFqdn := b .getPublicFqdn (tt .Fqn )
64
- if ! regexp . MustCompile ( tt .PublicFqdn ). MatchString ( publicFqdn ) {
63
+ if tt .PublicFqdn != publicFqdn {
65
64
t .Errorf ("expected public fqdn %q, got %q" , tt .PublicFqdn , publicFqdn )
66
65
}
67
66
0 commit comments