Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question -- did this ever work before? meaning, would we ever get a response that doesn't match the regex legitimately? If so should it be a warning? Or is it that this doesn't work at all right now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I've only tested on OSX and just incase someone elses setup doesn't match the regex (which I'm not sure would work) I figured a fall-through with a warning was a good approach. I also considered just throwing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity what does the minikube command return for you? wondering if it's something that varies by version or we have a problem with the command outputting extra stuff. Seems like it intends to only return a URL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talking with Stavros, this was not happening on previous version of minikube, so if we strip it, we just need to be careful it also works with earlier revs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the problem is that it's * some://url:port[whitespace] then this looks like a fine fix. Would it help unblock other PRs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be backward compatible. No junk prefix, then that subexpression is empty.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@holdenk OK to merge? seems like a decent fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad for not responding sooner, yeah it's fine :)

}
url
}
}
}
Expand Down