Skip to content

Commit 867362e

Browse files
chore: report library test failures to flakybot (#199)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * build(python): enable flakybot on library unit and system tests Source-Author: Bu Sun Kim <[email protected]> Source-Date: Wed Feb 17 14:10:46 2021 -0700 Source-Repo: googleapis/synthtool Source-Sha: d17674372e27fb8f23013935e794aa37502071aa Source-Link: googleapis/synthtool@d176743
1 parent dfce3da commit 867362e

File tree

6 files changed

+36
-11
lines changed

6 files changed

+36
-11
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ docs.metadata
5050

5151
# Virtual environment
5252
env/
53+
54+
# Test logs
5355
coverage.xml
54-
sponge_log.xml
56+
*sponge_log.xml
5557

5658
# System test environment variables.
5759
system_tests/local_test_setup

.kokoro/build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ python3 -m pip uninstall --yes --quiet nox-automation
4040
python3 -m pip install --upgrade --quiet nox
4141
python3 -m nox --version
4242

43+
# If this is a continuous build, send the test log to the FlakyBot.
44+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
45+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
46+
cleanup() {
47+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
48+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
49+
}
50+
trap cleanup EXIT HUP
51+
fi
52+
4353
# If NOX_SESSION is set, it only runs the specified session,
4454
# otherwise run all the sessions.
4555
if [[ -n "${NOX_SESSION:-}" ]]; then

.kokoro/test-samples.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do
8787
python3.6 -m nox -s "$RUN_TESTS_SESSION"
8888
EXIT=$?
8989

90-
# If this is a periodic build, send the test log to the Build Cop Bot.
91-
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
90+
# If this is a periodic build, send the test log to the FlakyBot.
91+
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
9292
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
93-
chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
94-
$KOKORO_GFILE_DIR/linux_amd64/buildcop
93+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
94+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
9595
fi
9696

9797
if [[ $EXIT -ne 0 ]]; then

.kokoro/trampoline_v2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
159159
"KOKORO_GITHUB_COMMIT"
160160
"KOKORO_GITHUB_PULL_REQUEST_NUMBER"
161161
"KOKORO_GITHUB_PULL_REQUEST_COMMIT"
162-
# For Build Cop Bot
162+
# For FlakyBot
163163
"KOKORO_GITHUB_COMMIT_URL"
164164
"KOKORO_GITHUB_PULL_REQUEST_URL"
165165
)

noxfile.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def default(session):
9191
session.run(
9292
"py.test",
9393
"--quiet",
94+
f"--junitxml=unit_{session.python}_sponge_log.xml",
9495
"--cov=google/cloud",
9596
"--cov=tests/unit",
9697
"--cov-append",
@@ -145,9 +146,21 @@ def system(session):
145146

146147
# Run py.test against the system tests.
147148
if system_test_exists:
148-
session.run("py.test", "--quiet", system_test_path, *session.posargs)
149+
session.run(
150+
"py.test",
151+
"--quiet",
152+
f"--junitxml=system_{session.python}_sponge_log.xml",
153+
system_test_path,
154+
*session.posargs,
155+
)
149156
if system_test_folder_exists:
150-
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
157+
session.run(
158+
"py.test",
159+
"--quiet",
160+
f"--junitxml=system_{session.python}_sponge_log.xml",
161+
system_test_folder_path,
162+
*session.posargs,
163+
)
151164

152165

153166
@nox.session(python=DEFAULT_PYTHON_VERSION)

synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-logging.git",
7-
"sha": "18a0bb7fd8d158baef532b1c715524e5f6303311"
7+
"sha": "de9c4c8bca265f6ecf98ecb9aa145891586232c8"
88
}
99
},
1010
{
@@ -19,14 +19,14 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e"
22+
"sha": "d17674372e27fb8f23013935e794aa37502071aa"
2323
}
2424
},
2525
{
2626
"git": {
2727
"name": "synthtool",
2828
"remote": "https://github.com/googleapis/synthtool.git",
29-
"sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e"
29+
"sha": "d17674372e27fb8f23013935e794aa37502071aa"
3030
}
3131
}
3232
],

0 commit comments

Comments
 (0)