From 75cfda0ffe240fdfb8db8ef7cfd3bfd392256f9f Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Mon, 22 Mar 2021 16:54:11 -0700 Subject: [PATCH] prepare-for-integration-tests.sh: Check Chrome and chromedriver versions They usually need to match, or at least be close, so added some code to help us remember to do that. --- hack/prepare-for-integration-tests.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hack/prepare-for-integration-tests.sh b/hack/prepare-for-integration-tests.sh index a14aa13f..e317c8f9 100755 --- a/hack/prepare-for-integration-tests.sh +++ b/hack/prepare-for-integration-tests.sh @@ -116,6 +116,22 @@ check_dependency htpasswd "Please install htpasswd. Should be pre-installed on M check_dependency openssl "Please install openssl. Should be pre-installed on MacOS." check_dependency chromedriver "Please install chromedriver. e.g. 'brew install chromedriver' for MacOS" +# Check that Chrome and chromedriver versions match. If chromedriver falls a couple versions behind +# then usually tests start to fail with strange error messages. +if [[ "$OSTYPE" == "darwin"* ]]; then + chrome_version=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) +else + chrome_version=$(google-chrome --version | cut -d ' ' -f3 | cut -d '.' -f1) +fi +chromedriver_version=$(chromedriver --version | cut -d ' ' -f2 | cut -d '.' -f1) +if [[ "$chrome_version" != "$chromedriver_version" ]]; then + log_error "It appears that you are using Chrome $chrome_version with chromedriver $chromedriver_version." + log_error "Please use the same version of chromedriver as Chrome." + log_error "If you are using the latest version of Chrome, then you can upgrade" + log_error "to the latest chromedriver, e.g. 'brew upgrade chromedriver' on MacOS." + exit 1 +fi + # Require kubectl >= 1.18.x if [ "$(kubectl version --client=true --short | cut -d '.' -f 2)" -lt 18 ]; then log_error "kubectl >= 1.18.x is required, you have $(kubectl version --client=true --short | cut -d ':' -f2)"