Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add required testing on Python 3.8.12 #29116

Merged
merged 47 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
053db49
move query-valid-python-version to lib, add sanity check for SENTRY_P…
joshuarli Oct 4, 2021
d69ad1e
remove sanity check since SENTRY_PYTHON_VERSION is only set if direnv…
joshuarli Oct 4, 2021
5f44b7f
Revert "remove sanity check since SENTRY_PYTHON_VERSION is only set i…
joshuarli Oct 4, 2021
12372a1
fix: let SENTRY_PYTHON_VERSION override get-pyenv-version
joshuarli Oct 4, 2021
32b1b9e
fix
joshuarli Oct 4, 2021
d335fcf
evan you happy now?
joshuarli Oct 4, 2021
48ed287
fix, lol
joshuarli Oct 4, 2021
9c3ecf1
[skip ci] evan pls
joshuarli Oct 4, 2021
e7277f3
few small ci updates
joshuarli Oct 4, 2021
633b824
go away unboundlocal
joshuarli Oct 4, 2021
8aee9d5
is this going to be 2x2 instances?
joshuarli Oct 4, 2021
d7a4765
fix: can't use psycopg-binary 2.9.x in 3.8 with Django 2.2
joshuarli Oct 5, 2021
4a12386
Merge remote-tracking branch 'origin/master' into test/optional-py38
joshuarli Oct 5, 2021
e563d44
Revert "fix: can't use psycopg-binary 2.9.x in 3.8 with Django 2.2"
joshuarli Oct 5, 2021
f4ca150
change to explicitly test only 3.6.13 for now, also adopt https://git…
joshuarli Oct 5, 2021
391964b
python-version 3.6.13 matrix everywhere
joshuarli Oct 5, 2021
08b2188
add 3.8
joshuarli Oct 6, 2021
b8c8b5f
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 6, 2021
eb8fa09
make check titles consistent by making python version come first
joshuarli Oct 6, 2021
e1d2b24
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 7, 2021
01cae19
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 7, 2021
28bb46f
fix mypy
joshuarli Oct 8, 2021
bab9c5c
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 11, 2021
ddc2a07
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 14, 2021
cf689e3
is dual visual snapshotting as easy as this
joshuarli Oct 14, 2021
2aae397
Revert "is dual visual snapshotting as easy as this"
joshuarli Oct 14, 2021
bdc874a
only visual snapshot on 3.6
joshuarli Oct 14, 2021
198b29c
set warn_unused_ignores=False and get mypy to actually use config file
joshuarli Oct 18, 2021
5c9eacd
no idea why its being deselected
joshuarli Oct 18, 2021
0729e9e
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 18, 2021
6ac87f6
Revert "no idea why its being deselected"
joshuarli Oct 18, 2021
369fce3
debug
joshuarli Oct 18, 2021
58cc93c
hacky fix
joshuarli Oct 18, 2021
dda38ab
hardcode MATRIX_INSTANCE_TOTAL
joshuarli Oct 19, 2021
39ff322
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 19, 2021
fe43c29
LOL
joshuarli Oct 19, 2021
f501407
lol 2
joshuarli Oct 19, 2021
f99d583
fix frontend tests
joshuarli Oct 19, 2021
d4238d7
MATRIX_INSTANCE_TOTAL isn't needed for this
joshuarli Oct 19, 2021
483ab2e
dont run mypy on 3.8
joshuarli Oct 19, 2021
bda99f7
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 19, 2021
07c9b0a
Revert "fix mypy"
joshuarli Oct 19, 2021
b909931
revert mypy changes
joshuarli Oct 19, 2021
20fb2c0
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 19, 2021
1a94b1e
lol
joshuarli Oct 19, 2021
07b70d2
Revert "lol"
joshuarli Oct 20, 2021
6f5f2d3
Merge remote-tracking branch 'origin/master' into test/add-py38
joshuarli Oct 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/actions/setup-sentry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ outputs:
matrix-instance-number:
description: "The matrix instance number (starting at 1)"
value: ${{ steps.config.outputs.matrix-instance-number }}
matrix-instance-total:
description: "Reexport of MATRIX_INSTANCE_TOTAL."
value: ${{ steps.config.outputs.matrix-instance-total }}

runs:
using: "composite"
Expand All @@ -63,7 +66,10 @@ runs:
env:
NEED_KAFKA: ${{ inputs.kafka }}
MATRIX_INSTANCE: ${{ matrix.instance }}
MATRIX_INSTANCE_TOTAL: ${{ strategy.job-total }}
# XXX: We should be using something like len(strategy.matrix.instance) (not possible atm)
# If you have other things like python-version: [foo, bar, baz] then the sharding logic
# isn't right because job-total will be 3x larger and you'd never run 2/3 of the tests.
# MATRIX_INSTANCE_TOTAL: ${{ strategy.job-total }}
Comment on lines +69 to +72
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah -- when we were doing 2.7, 3.6 - I opted to make a new workflow file with this being a reason. The other reason being that restarting the acceptance workflow would re-run acceptance tests for both python versions + frontend acceptance tests (when a flake probably wouldn't affect all jobs in the workflow).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I could have done that too... given that it's already working + I expect being able to remove 3.6 pretty quickly, I'll just leave it like this if that's ok? The way it is now, it's less prone to introducing something to the matrix and not realizing some sharded tests aren't being run. Plus the comments about the strategy matrix are helpful for the future.

run: |
# Only set `MIGRATIONS_TEST_MIGRATE` if it is not already set (or if it's an empty string)
if [ -z $MIGRATIONS_TEST_MIGRATE ]; then
Expand All @@ -81,11 +87,17 @@ runs:
### pytest-sentry configuration ###
echo "PYTEST_SENTRY_DSN=https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079" >> $GITHUB_ENV
echo "PYTEST_ADDOPTS=--reruns 5" >> $GITHUB_ENV

# this handles pytest test sharding
if [ "$MATRIX_INSTANCE" ]; then
if ! [ "$MATRIX_INSTANCE_TOTAL" ]; then
echo "MATRIX_INSTANCE_TOTAL is required."
exit 1
fi
echo "TEST_GROUP=$MATRIX_INSTANCE" >> $GITHUB_ENV
echo "TOTAL_TEST_GROUPS=$MATRIX_INSTANCE_TOTAL" >> $GITHUB_ENV
fi

# This records failures on master to sentry in order to detect flakey tests, as it's
# expected that people have failing tests on their PRs
[ "$GITHUB_REF" = "refs/heads/master" ] && echo "PYTEST_SENTRY_ALWAYS_REPORT=1" >> $GITHUB_ENV || true
Expand Down Expand Up @@ -124,6 +136,7 @@ runs:
run: |
echo "::set-output name=yarn-cache-dir::$(yarn cache dir)"
echo "::set-output name=matrix-instance-number::$(($MATRIX_INSTANCE+1))"
echo "::set-output name=matrix-instance-total::$(($MATRIX_INSTANCE_TOTAL))"
echo "::set-output name=acceptance-dir::.artifacts/visual-snapshots/acceptance"

- name: Install python dependencies
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
# XXX: When updating this, make sure you also update CI_NODE_TOTAL.
instance: [0, 1]

env:
Expand Down Expand Up @@ -55,7 +56,10 @@ jobs:
env:
GITHUB_PR_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
GITHUB_PR_REF: ${{ github.event.pull_request.head.ref || github.ref }}
CI_NODE_TOTAL: ${{ strategy.job-total }}
# XXX: CI_NODE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
# Otherwise, if there are other things in the matrix, using strategy.job-total
# wouldn't be correct.
CI_NODE_TOTAL: 2
CI_NODE_INDEX: ${{ matrix.instance }}
run: |
JEST_TESTS=$(yarn -s jest --listTests --json) yarn test-ci --forceExit
Expand Down Expand Up @@ -146,10 +150,12 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
python-version: [3.6.13, 3.8.12]
# XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
instance: [0, 1, 2, 3]
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
env:
# XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
MATRIX_INSTANCE_TOTAL: 4
VISUAL_SNAPSHOT_ENABLE: 1
TEST_GROUP_STRATEGY: roundrobin

Expand Down Expand Up @@ -182,7 +188,7 @@ jobs:
run: |
tar xf dist.tar.gz

- name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
if: always()
run: |
mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
Expand All @@ -209,10 +215,13 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
# XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
instance: [0]
env:
# XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
MATRIX_INSTANCE_TOTAL: 1
TEST_GROUP_STRATEGY: roundrobin
VISUAL_SNAPSHOT_ENABLE: 1

steps:
Expand Down Expand Up @@ -244,7 +253,7 @@ jobs:
run: |
make build-chartcuterie-config

- name: Run chartcuterie tests (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- name: Run chartcuterie tests (${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
run: |
mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
make test-chartcuterie
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/api-docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
steps:
- uses: actions/checkout@v2

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/backend-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
steps:
- uses: actions/checkout@v2

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/backend-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
# XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
instance: [0, 1, 2]

env:
# XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
MATRIX_INSTANCE_TOTAL: 3
MIGRATIONS_TEST_MIGRATE: 1

steps:
Expand Down Expand Up @@ -52,7 +54,7 @@ jobs:
pip-cache-version: ${{ secrets.PIP_CACHE_VERSION }}
snuba: true

- name: Run backend test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- name: Run backend test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
if: steps.changes.outputs.backend == 'true'
run: |
# Note: `USE_SNUBA` is not used for backend tests because there are a few failing tests with Snuba enabled.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backend-typing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
timeout-minutes: 12
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
# TODO(joshuarli): Switch to 3.8.12 when we switch over to Python 3.8.
python-version: [3.6.13]
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/check-if-migration-is-required.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
needs: [should-check]

steps:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/command-line-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
steps:
- uses: actions/checkout@v2

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/development-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
# Using Ubuntu 18 until I figure out this error:
# -> ImportError: libffi.so.6: cannot open shared object file: No such file or directory
os: [macos-11.0, ubuntu-18.04]
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
fail-fast: false
env:
PIP_DISABLE_PIP_VERSION_CHECK: on
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ jobs:
timeout-minutes: 8
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
needs: did-migration-change
if: ${{ needs.did-migration-change.outputs.added == 'true' }}

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/plugins-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
steps:
- uses: actions/checkout@v2

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/relay-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
steps:
- uses: actions/checkout@v2
with:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/snuba-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: [3.6.13, 3.8.12]
# XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
instance: [0, 1]
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
env:
# XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
MATRIX_INSTANCE_TOTAL: 2
USE_SNUBA: 1
MIGRATIONS_TEST_MIGRATE: 1
USE_INDEXER: 1
Expand Down Expand Up @@ -54,7 +56,7 @@ jobs:
snuba: true
kafka: true

- name: Run snuba test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ strategy.job-total }})
- name: Run snuba test (${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
if: steps.changes.outputs.backend == 'true'
run: |
make test-snuba
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/symbolicator-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
# TODO(joshuarli): Add 3.8.12.
python-version: [3.6.13]
python-version: [3.6.13, 3.8.12]
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ disallow_incomplete_defs=True
check_untyped_defs=True
disallow_untyped_decorators=True
no_implicit_optional=True
warn_redundant_casts=True
warn_unused_ignores=True
warn_redundant_casts=True
warn_return_any=True
no_implicit_reexport=True

Expand Down
3 changes: 2 additions & 1 deletion src/sentry/utils/pytest/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ def snapshot(self, name, mobile_only=False):
"""
# TODO(dcramer): ideally this would take the executing test package
# into account for duplicate names
if os.environ.get("VISUAL_SNAPSHOT_ENABLE") != "1":
# TODO(josh): Change to 3.8 when it's deployed. Much easier to disable here than in GHA yml.
if os.environ.get("VISUAL_SNAPSHOT_ENABLE") != "1" or sys.version_info[:2] != (3, 6):
return self

self.wait_for_images_loaded()
Expand Down