[SPARK-28886][K8S] Fix the DepsTestsSuite with minikube 1.3.1

### What changes were proposed in this pull request?

Matches the response from minikube service against a regex to extract the URL

### Why are the changes needed?

minikube 1.3.1 on OSX has different formatting than expected

### Does this PR introduce any user-facing change?

No

### How was this patch tested?

Ran the existing integration test run on OSX with minikube 1.3.1

Closes #25599 from holdenk/SPARK-28886-fix-deps-tests-with-minikube-1.3.1.

Authored-by: Holden Karau <hkarau@apple.com>
Signed-off-by: Sean Owen <sean.owen@databricks.com>
This commit is contained in:
Holden Karau 2019-09-08 20:04:16 -05:00 committed by Sean Owen
parent 1f056eb313
commit 0ed9fae457

View file

@ -224,9 +224,20 @@ private[spark] trait DepsTestsSuite { k8sSuite: KubernetesSuite =>
}
private def getServiceUrl(serviceName: String): String = {
val fuzzyUrlMatcher = """^(.*?)([a-zA-Z]+://.*?)(\s*)$""".r
Eventually.eventually(TIMEOUT, INTERVAL) {
// ns is always available either random or provided by the user
Minikube.minikubeServiceAction(serviceName, "-n", kubernetesTestComponents.namespace, "--url")
val rawUrl = Minikube.minikubeServiceAction(
serviceName, "-n", kubernetesTestComponents.namespace, "--url")
val url = rawUrl match {
case fuzzyUrlMatcher(junk, url, extra) =>
logDebug(s"Service url matched junk ${junk} - url ${url} - extra ${extra}")
url
case _ =>
logWarning(s"Response from minikube ${rawUrl} did not match URL regex")
rawUrl
}
url
}
}
}