From 2af9324d154647db6c3823691b5f160d17649e45 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 18 Feb 2021 07:49:04 -0800 Subject: [PATCH] build(python): enable flakybot on library unit and system tests (#75) Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Source-Date: Wed Feb 17 14:10:46 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: d17674372e27fb8f23013935e794aa37502071aa Source-Link: https://github.com/googleapis/synthtool/commit/d17674372e27fb8f23013935e794aa37502071aa --- packages/google-cloud-container/.gitignore | 4 +++- .../google-cloud-container/.kokoro/build.sh | 10 ++++++++++ packages/google-cloud-container/noxfile.py | 17 +++++++++++++++-- packages/google-cloud-container/synth.metadata | 4 ++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/packages/google-cloud-container/.gitignore b/packages/google-cloud-container/.gitignore index b9daa52f118d..b4243ced74e4 100644 --- a/packages/google-cloud-container/.gitignore +++ b/packages/google-cloud-container/.gitignore @@ -50,8 +50,10 @@ docs.metadata # Virtual environment env/ + +# Test logs coverage.xml -sponge_log.xml +*sponge_log.xml # System test environment variables. system_tests/local_test_setup diff --git a/packages/google-cloud-container/.kokoro/build.sh b/packages/google-cloud-container/.kokoro/build.sh index 743a3b198e87..5504b40e702f 100755 --- a/packages/google-cloud-container/.kokoro/build.sh +++ b/packages/google-cloud-container/.kokoro/build.sh @@ -40,6 +40,16 @@ python3 -m pip uninstall --yes --quiet nox-automation python3 -m pip install --upgrade --quiet nox python3 -m nox --version +# If this is a continuous build, send the test log to the FlakyBot. +# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then + cleanup() { + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot + } + trap cleanup EXIT HUP +fi + # If NOX_SESSION is set, it only runs the specified session, # otherwise run all the sessions. if [[ -n "${NOX_SESSION:-}" ]]; then diff --git a/packages/google-cloud-container/noxfile.py b/packages/google-cloud-container/noxfile.py index e341a737d409..b748fa1c3b1f 100644 --- a/packages/google-cloud-container/noxfile.py +++ b/packages/google-cloud-container/noxfile.py @@ -93,6 +93,7 @@ def default(session): session.run( "py.test", "--quiet", + f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=google/cloud", "--cov=tests/unit", "--cov-append", @@ -141,9 +142,21 @@ def system(session): # Run py.test against the system tests. if system_test_exists: - session.run("py.test", "--quiet", system_test_path, *session.posargs) + session.run( + "py.test", + "--quiet", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_path, + *session.posargs, + ) if system_test_folder_exists: - session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) + session.run( + "py.test", + "--quiet", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_folder_path, + *session.posargs, + ) @nox.session(python=DEFAULT_PYTHON_VERSION) diff --git a/packages/google-cloud-container/synth.metadata b/packages/google-cloud-container/synth.metadata index 87ad3f4eb378..5a9e2df3ba78 100644 --- a/packages/google-cloud-container/synth.metadata +++ b/packages/google-cloud-container/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-container.git", - "sha": "a9aa69705440915c2f2aff20c2722bd596b8e7ec" + "sha": "7ed5e591e9a4a9a58dc1340bbe40dcc986feca7f" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e" + "sha": "d17674372e27fb8f23013935e794aa37502071aa" } } ],