Skip to content

Commit b67291e

Browse files
committed
Skip TCP domains when finding default domain in integration tests
We recently began seeing failures when a TCP route (a route using a TCP domain) was being used unexpectedly. I believe it is because this DefaultSharedDomain helper was not excluding domains with protocol "tcp". Now, we exclude them, just like we do for internal domains, so that the "default domain" it finds will never be a TCP domain. Authored-by: Reid Mitchell <[email protected]>
1 parent 26e9718 commit b67291e

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

integration/helpers/domains.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,31 @@ func DefaultSharedDomain() string {
4242
session := CF("domains")
4343
Eventually(session).Should(Exit(0))
4444

45-
regex := regexp.MustCompile(`(.+?)\s+shared.*`)
46-
4745
output := strings.Split(string(session.Out.Contents()), "\n")
4846
for _, line := range output {
49-
if line != "" && !strings.HasPrefix(line, "integration-") {
50-
matches := regex.FindStringSubmatch(line)
51-
if len(matches) == 2 && !strings.Contains(matches[0], "true") && !strings.Contains(matches[0], "internal") {
52-
foundDefaultDomain = matches[1]
53-
break
54-
}
47+
if line == "" {
48+
// Skip empty lines
49+
continue
50+
}
51+
52+
if strings.HasPrefix(line, "integration-") {
53+
// Skip domains created as part of integration tests
54+
continue
55+
}
56+
57+
if strings.HasSuffix(line, "tcp") {
58+
// Skip domains with protocol "tcp"
59+
continue
60+
}
61+
62+
regex := regexp.MustCompile(`(.+?)\s+shared.*`)
63+
matches := regex.FindStringSubmatch(line)
64+
if len(matches) == 2 && !strings.Contains(matches[0], "true") && !strings.Contains(matches[0], "internal") {
65+
foundDefaultDomain = matches[1]
66+
break
5567
}
5668
}
69+
5770
Expect(foundDefaultDomain).ToNot(BeEmpty())
5871
}
5972
return foundDefaultDomain

0 commit comments

Comments
 (0)