Skip to content

Commit

Permalink
chore: Update testing configs and structure for speed (#578)
Browse files Browse the repository at this point in the history
* Initial test config changes

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

* Update build configs to match google3 job configs

* Rename required presubmit CI check

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Force OwlBot to avoid overwriting Kokoro configs

* Undo OwlBot overwrite

* Update OwlBot.py

* Fix double install of SDK in sample nox sessions

* Empty requirements.txt files to trigger Sample CI

* Update Nox env var to use spaces, not csv

* Update parallel dist in presubmit

* Address reviewer comments, final changes

* Limit presubmit to unit-3.6, widen release presubmit to all unit tests

* Update presubmit to unit-3.7 only

* Unit 3.6, 3.7 in presubmit to check coverage

* Presubmit to unit-3.8

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
vinnysenthil and gcf-owl-bot[bot] committed Aug 12, 2021
1 parent 4e7666a commit 3612b05
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ branchProtectionRules:
requiresCodeOwnerReviews: true
requiresStrictStatusChecks: true
requiredStatusCheckContexts:
- 'Kokoro'
- 'cla/google'
- 'Samples - Lint'
- 'Presubmit - Unit Tests'
10 changes: 10 additions & 0 deletions .kokoro/continuous/system.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
env_vars: {
key: "NOX_SESSION"
value: "system-3.8"
}

# Run system tests in parallel, splitting up by file
env_vars: {
key: "PYTEST_ADDOPTS"
value: "-n=auto --dist=loadfile"
}
11 changes: 11 additions & 0 deletions .kokoro/continuous/unit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Run all unit test sessions, in Python 3.6 to 3.9
env_vars: {
key: "NOX_SESSION"
value: "unit"
}

# Run unit tests in parallel, splitting up by test
env_vars: {
key: "PYTEST_ADDOPTS"
value: "-n=auto"
}
14 changes: 13 additions & 1 deletion .kokoro/presubmit/presubmit.cfg
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Format: //devtools/kokoro/config/proto/build.proto
# Format: //devtools/kokoro/config/proto/build.proto

# Run all sessions except system tests and docs builds
env_vars: {
key: "NOX_SESSION"
value: "unit-3.8 lint lint_setup_py blacken cover"
}

# Run unit tests in parallel, splitting up by file
env_vars: {
key: "PYTEST_ADDOPTS"
value: "-n=auto --dist=loadfile"
}
11 changes: 11 additions & 0 deletions .kokoro/presubmit/release.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Run system tests in presubmit for library releases
env_vars: {
key: "NOX_SESSION"
value: "system-3.8 unit"
}

# Run system tests in parallel, splitting up by file
env_vars: {
key: "PYTEST_ADDOPTS"
value: "-n=auto --dist=loadfile"
}
1 change: 1 addition & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
templated_files,
excludes=[
".coveragerc",
".kokoro/**/*.cfg"
]
) # the microgenerator has a good coveragerc file

Expand Down
4 changes: 3 additions & 1 deletion samples/model-builder/noxfile_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@
"pip_version_override": None,
# A dictionary you want to inject into your test. Don't put any
# secrets here. These values will override predefined values.
"envs": {},
"envs": {
"PYTEST_ADDOPTS": "-n=auto" # Run tests parallel using all available CPUs
},
}
2 changes: 2 additions & 0 deletions samples/model-builder/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest==6.2.4
pytest-xdist
1 change: 0 additions & 1 deletion samples/model-builder/requirements-tests.txt

This file was deleted.

3 changes: 1 addition & 2 deletions samples/model-builder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pytest >= 6.2
git+https://github.com/googleapis/python-aiplatform.git@mb-release#egg=google-cloud-aiplatform
google-cloud-aiplatform
3 changes: 2 additions & 1 deletion samples/snippets/noxfile_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# A dictionary you want to inject into your test. Don't put any
# secrets here. These values will override predefined values.
"envs": {
"DATA_LABELING_API_ENDPOINT": "us-central1-autopush-aiplatform.sandbox.googleapis.com"
"DATA_LABELING_API_ENDPOINT": "us-central1-autopush-aiplatform.sandbox.googleapis.com",
"PYTEST_ADDOPTS": "-n=auto" # Run tests parallel using all available CPUs
},
}
2 changes: 2 additions & 0 deletions samples/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pytest==6.2.4
pytest-xdist
1 change: 0 additions & 1 deletion samples/snippets/requirements-tests.txt

This file was deleted.

4 changes: 1 addition & 3 deletions samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
pytest==6.2.4
google-cloud-storage>=1.26.0, <2.0.0dev
google-cloud-aiplatform==1.3.0
google-cloud-aiplatform
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
full_extra_require = list(
set(tensorboard_extra_require + metadata_extra_require + xai_extra_require)
)
testing_extra_require = full_extra_require + ["grpcio-testing"]
testing_extra_require = full_extra_require + ["grpcio-testing", "pytest-xdist"]


setuptools.setup(
Expand Down

0 comments on commit 3612b05

Please sign in to comment.