Skip to content

Commit 55bed36

Browse files
committed
including other patches necessary to run tests
1 parent 9e12580 commit 55bed36

3 files changed

Lines changed: 37 additions & 13 deletions

File tree

cloudbuild/Dockerfile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ COPY --chown=ia-tests:ia-tests . /init-actions
99

1010
# Install Bazel:
1111
# https://docs.bazel.build/versions/master/install-ubuntu.html
12-
ENV bazel_kr_path=/usr/share/keyrings/bazel-keyring.gpg
12+
ENV bazel_kr_path=/usr/share/keyrings/bazel-keyring.gpg \
13+
bazel_version=7.4.0 \
14+
bazel_repo_data="http://storage.googleapis.com/bazel-apt stable jdk1.8" \
15+
bazel_repo_file="/etc/apt/sources.list.d/bazel.list" \
16+
DEBIAN_FRONTEND=noninteractive
1317
RUN apt-get install -y -qq curl >/dev/null 2>&1 && \
1418
apt-get clean
15-
RUN /usr/bin/curl https://bazel.build/bazel-release.pub.gpg | \
16-
gpg --dearmor -o "${bazel_kr_path}"
17-
RUN echo "deb [arch=amd64 signed-by=${bazel_kr_path}] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \
18-
dd of=/etc/apt/sources.list.d/bazel.list status=none && \
19+
RUN /usr/bin/curl -s https://bazel.build/bazel-release.pub.gpg | \
20+
gpg --import --no-default-keyring --keyring "${bazel_kr_path}" && \
21+
echo "deb [arch=amd64 signed-by=${bazel_kr_path}] ${bazel_repo_data}" | \
22+
dd of="${bazel_repo_file}" status=none && \
1923
apt-get update -qq
20-
RUN apt-get autoremove -y -qq && \
21-
apt-get install -y -qq openjdk-8-jdk python3-setuptools bazel >/dev/null 2>&1 && \
24+
RUN apt-get autoremove -y -qq > /dev/null 2>&1 && \
25+
apt-get install -y -qq default-jdk python3-setuptools bazel-${bazel_version} > /dev/null 2>&1 && \
2226
apt-get clean
2327

28+
# Set bazel-${bazel_version} as the default bazel alternative in this container
29+
RUN update-alternatives --install /usr/bin/bazel bazel /usr/bin/bazel-${bazel_version} 1 && \
30+
update-alternatives --set bazel /usr/bin/bazel-${bazel_version}
31+
2432
USER ia-tests

cloudbuild/presubmit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ initialize_git_repo() {
4949
determine_tests_to_run() {
5050
# Infer the files that changed
5151
mapfile -t DELETED_BUILD_FILES < <(git diff origin/master --name-only --diff-filter=D | grep BUILD)
52-
mapfile -t CHANGED_FILES < <(git diff origin/master --name-only)
52+
mapfile -t CHANGED_FILES < <(git diff origin/master --name-only | grep -v template)
5353
echo "Deleted BUILD files: ${DELETED_BUILD_FILES[*]}"
5454
echo "Changed files: ${CHANGED_FILES[*]}"
5555

@@ -70,6 +70,7 @@ determine_tests_to_run() {
7070
changed_dir="${changed_dir%%/*}/"
7171
# Run all tests if common directories modified
7272
if [[ ${changed_dir} =~ ^(integration_tests|util|cloudbuild)/$ ]]; then
73+
continue
7374
echo "All tests will be run: '${changed_dir}' was changed"
7475
TESTS_TO_RUN=(":DataprocInitActionsTestSuite")
7576
return 0
@@ -104,7 +105,6 @@ run_tests() {
104105
bazel test \
105106
--jobs="${max_parallel_tests}" \
106107
--local_test_jobs="${max_parallel_tests}" \
107-
--flaky_test_attempts=3 \
108108
--action_env="INTERNAL_IP_SSH=true" \
109109
--test_output="all" \
110110
--noshow_progress \

integration_tests/dataproc_test_case.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import string
88
import subprocess
99
import sys
10+
import time
11+
import random
1012
from threading import Timer
1113

1214
import pkg_resources
@@ -287,10 +289,24 @@ def assert_instance_command(self,
287289
AssertionError: if command returned non-0 exit code.
288290
"""
289291

290-
ret_code, stdout, stderr = self.assert_command(
291-
'gcloud compute ssh {} --zone={} --command="{}"'.format(
292-
instance, self.cluster_zone, cmd), timeout_in_minutes)
293-
return ret_code, stdout, stderr
292+
retry_count = 5
293+
294+
ssh_cmd='gcloud compute ssh -q {} --zone={} --command="{}" -- -o ConnectTimeout=60'.format(
295+
instance, self.cluster_zone, cmd)
296+
297+
while retry_count > 0:
298+
try:
299+
ret_code, stdout, stderr = self.assert_command(
300+
ssh_cmd, timeout_in_minutes )
301+
return ret_code, stdout, stderr
302+
except Exception as e:
303+
print("An error occurred: ", e)
304+
retry_count -= 1
305+
if retry_count > 0:
306+
time.sleep( 3 + random.randint(1, 10) )
307+
continue
308+
else:
309+
raise
294310

295311
def assert_dataproc_job(self,
296312
cluster_name,

0 commit comments

Comments
 (0)