Add more strict IPv6 regex

Previous IPv6 regex was too loose, this patchs adds a better and
more strict regex for IPv6 addresses and makes the IPv4 and IPv6
regex availables as constants inside the framework pkg
This commit is contained in:
Antonio Ojea
2019-04-24 23:37:24 +02:00
parent ae4ccc91b2
commit d528944a03
2 changed files with 6 additions and 2 deletions

View File

@@ -78,7 +78,7 @@ var _ = Describe("[sig-node] Downward API", func() {
expectations := []string{
fmt.Sprintf("POD_NAME=%v", podName),
fmt.Sprintf("POD_NAMESPACE=%v", f.Namespace.Name),
"POD_IP=(?:\\d+\\.\\d+\\.\\d+\\.\\d+|[a-fA-F0-9:]+)",
fmt.Sprintf("POD_IP=%v|%v", framework.RegexIPv4, framework.RegexIPv6),
}
testDownwardAPI(f, podName, env, expectations)
@@ -105,7 +105,7 @@ var _ = Describe("[sig-node] Downward API", func() {
}
expectations := []string{
"HOST_IP=(?:\\d+\\.\\d+\\.\\d+\\.\\d+|[a-fA-F0-9:]+)",
fmt.Sprintf("HOST_IP=%v|%v", framework.RegexIPv4, framework.RegexIPv6),
}
testDownwardAPI(f, podName, env, expectations)