Skip to content

Commit 80e7781

Browse files
authored
Misc integration test improvements (#1634)
As part of adding Poetry + `.python-version` file support, a fair amount of buildpack refactoring will be required. This backports some of the additional test scenarios we now have in the new Python CNB, along with some test general improvements. It's been split out of later PRs for easier review. GUS-W-16807487.
1 parent 0dde52d commit 80e7781

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+659
-155
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ jobs:
3333
matrix:
3434
stack: ["heroku-20", "heroku-22", "heroku-24"]
3535
env:
36-
HATCHET_APP_LIMIT: 200
36+
HATCHET_APP_LIMIT: 300
3737
HATCHET_DEFAULT_STACK: ${{ matrix.stack }}
3838
HATCHET_EXPENSIVE_MODE: 1
3939
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
4040
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
4141
HEROKU_DISABLE_AUTOUPDATE: 1
42-
PARALLEL_SPLIT_TEST_PROCESSES: 60
43-
RSPEC_RETRY_RETRY_COUNT: 3
42+
PARALLEL_SPLIT_TEST_PROCESSES: 70
43+
RSPEC_RETRY_RETRY_COUNT: 2
4444
steps:
4545
- name: Checkout
4646
uses: actions/checkout@v4

Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GEM
55
base64 (0.2.0)
66
diff-lcs (1.5.1)
77
erubis (2.7.0)
8-
excon (0.110.0)
8+
excon (0.111.0)
99
heroics (0.1.3)
1010
base64
1111
erubis (~> 2.0)
@@ -27,7 +27,7 @@ GEM
2727
parallel_split_test (0.10.0)
2828
parallel (>= 0.5.13)
2929
rspec-core (>= 3.9.0)
30-
parser (3.3.4.2)
30+
parser (3.3.5.0)
3131
ast (~> 2.4.1)
3232
racc
3333
platform-api (3.7.0)
@@ -39,32 +39,32 @@ GEM
3939
rate_throttle_client (0.1.2)
4040
regexp_parser (2.9.2)
4141
rrrretry (1.0.0)
42-
rspec-core (3.13.0)
42+
rspec-core (3.13.1)
4343
rspec-support (~> 3.13.0)
44-
rspec-expectations (3.13.2)
44+
rspec-expectations (3.13.3)
4545
diff-lcs (>= 1.2.0, < 2.0)
4646
rspec-support (~> 3.13.0)
4747
rspec-retry (0.6.2)
4848
rspec-core (> 3.3)
4949
rspec-support (3.13.1)
50-
rubocop (1.66.0)
50+
rubocop (1.66.1)
5151
json (~> 2.3)
5252
language_server-protocol (>= 3.17.0)
5353
parallel (~> 1.10)
5454
parser (>= 3.3.0.2)
5555
rainbow (>= 2.2.2, < 4.0)
5656
regexp_parser (>= 2.4, < 3.0)
57-
rubocop-ast (>= 1.32.1, < 2.0)
57+
rubocop-ast (>= 1.32.2, < 2.0)
5858
ruby-progressbar (~> 1.7)
5959
unicode-display_width (>= 2.4.0, < 3.0)
60-
rubocop-ast (1.32.1)
60+
rubocop-ast (1.32.3)
6161
parser (>= 3.3.1.0)
62-
rubocop-rspec (3.0.4)
62+
rubocop-rspec (3.0.5)
6363
rubocop (~> 1.61)
6464
ruby-progressbar (1.13.0)
65-
thor (1.3.1)
65+
thor (1.3.2)
6666
threaded (0.0.4)
67-
unicode-display_width (2.5.0)
67+
unicode-display_width (2.6.0)
6868
webrick (1.8.1)
6969

7070
PLATFORMS
@@ -80,7 +80,7 @@ DEPENDENCIES
8080
rubocop-rspec
8181

8282
RUBY VERSION
83-
ruby 3.3.2p78
83+
ruby 3.3.5p100
8484

8585
BUNDLED WITH
86-
2.5.11
86+
2.5.18

bin/steps/pipenv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ if [[ -f Pipfile ]]; then
1515
meta_set "package_manager" "pipenv"
1616

1717
# Skip installing dependencies using pip later.
18+
# TODO: Stop leaking this env var into subshells such as post_compile hooks.
1819
export SKIP_PIP_INSTALL=1
1920

2021
# Set Pip env vars

spec/fixtures/ci_pipenv/Pipfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
typing-extensions = "*"
8+
9+
[dev-packages]
10+
pytest = "*"

spec/fixtures/ci_pipenv/Pipfile.lock

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/ci_pipenv/app.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"environments": {
3+
"test": {
4+
"scripts": {
5+
"test": "./bin/print-env-vars.sh && pytest --version"
6+
}
7+
}
8+
}
9+
}

spec/fixtures/ci_pipenv/bin/compile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is run by the inline buildpack, and tests that the environment is
4+
# configured as expected for buildpacks that run after the Python buildpack.
5+
6+
set -euo pipefail
7+
8+
BUILD_DIR="${1}"
9+
10+
cd "${BUILD_DIR}"
11+
12+
exec bin/print-env-vars.sh

spec/fixtures/ci_pipenv/bin/detect

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is run by the inline buildpack.
4+
5+
set -euo pipefail
6+
7+
echo "Inline"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
exec bin/print-env-vars.sh
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
printenv | sort | grep -vE '^(_|BUILDPACK_LOG_FILE|BUILD_DIR|CACHE_DIR|CI_NODE_.+|DYNO|ENV_DIR|HEROKU_TEST_RUN_.+|HOME|OLDPWD|PORT|PWD|SHLVL|STACK|TERM)='

spec/fixtures/ci_requirements/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"environments": {
33
"test": {
44
"scripts": {
5-
"test": "pytest --version"
5+
"test": "./bin/print-env-vars.sh && pytest --version"
66
}
77
}
88
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is run by the inline buildpack, and tests that the environment is
4+
# configured as expected for buildpacks that run after the Python buildpack.
5+
6+
set -euo pipefail
7+
8+
BUILD_DIR="${1}"
9+
10+
cd "${BUILD_DIR}"
11+
12+
exec bin/print-env-vars.sh
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is run by the inline buildpack.
4+
5+
set -euo pipefail
6+
7+
echo "Inline"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
exec bin/print-env-vars.sh
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
printenv | sort | grep -vE '^(_|BUILDPACK_LOG_FILE|BUILD_DIR|CACHE_DIR|CI_NODE_.+|DYNO|ENV_DIR|HEROKU_TEST_RUN_.+|HOME|OLDPWD|PORT|PWD|SHLVL|STACK|TERM)='
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest
1+
pytest==8.3.3
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
urllib3
1+
# This package has been picked since it has no dependencies and is small/fast to install.
2+
typing-extensions==4.12.2

spec/fixtures/hooks/bin/post_compile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
set -euo pipefail
44

5-
echo 'post_compile ran with env vars:'
6-
printenv | cut -d '=' -f 1 | sort
5+
echo '~ post_compile ran with env vars:'
6+
bin/print-env-vars.sh
7+
echo '~ post_compile complete'

spec/fixtures/hooks/bin/pre_compile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
set -euo pipefail
44

5-
echo 'pre_compile ran with env vars:'
6-
printenv | cut -d '=' -f 1 | sort
5+
echo '~ pre_compile ran with env vars:'
6+
bin/print-env-vars.sh
7+
echo '~ pre_compile complete'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
printenv | sort \
6+
| grep -vE '^(_|BUILDPACK_LOG_FILE|DYNO|OLDPWD|REQUEST_ID|SHLVL)=' \
7+
| sed --regexp-extended \
8+
--expression 's#(=/tmp/build_)[^:/]+#\1<hash>#' \
9+
--expression 's#^(ENV_DIR=/tmp/).*#\1...#' \
10+
--expression 's#^(SOURCE_VERSION=).*#\1...#'

spec/fixtures/pipenv_editable/bin/compile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ BUILD_DIR="${1}"
99

1010
cd "${BUILD_DIR}"
1111

12-
exec bin/test-entrypoints
12+
exec bin/test-entrypoints.sh

spec/fixtures/pipenv_editable/bin/post_compile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -euo pipefail
44

5-
exec bin/test-entrypoints
5+
exec bin/test-entrypoints.sh

spec/fixtures/pipenv_python_version_unspecified/Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
urllib3 = "*"
7+
typing-extensions = "*"
88

99
[dev-packages]

spec/fixtures/pipenv_python_version_unspecified/Pipfile.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is run by the inline buildpack, and tests that the environment is
4+
# configured as expected for buildpacks that run after the Python buildpack.
5+
6+
set -euo pipefail
7+
8+
printenv | sort | grep -vE '^(_|BUILDPACK_LOG_FILE|DYNO|HOME|PWD|REQUEST_ID|SHLVL|SOURCE_VERSION|STACK)='
9+
echo
10+
11+
python -c 'import pprint, sys; pprint.pp(sys.path)'
12+
echo
13+
14+
# TODO: Investigate why 'pipenv graph' doesn't work here.
15+
# TODO: Remove --disable-pip-version-check in favour of exporting PIP_DISABLE_PIP_VERSION_CHECK
16+
pip list --disable-pip-version-check
17+
echo
18+
19+
python -c 'import typing_extensions; print(typing_extensions)'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# This file is run by the inline buildpack.
4+
5+
set -euo pipefail
6+
7+
echo "Inline"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file is here to confirm we don't try and create the fallback requirements
2+
# file containing '-e .' when using Pipenv.
3+
4+
from setuptools import setup
5+
6+
setup(
7+
name='test',
8+
install_requires=['six'],
9+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.10.5
1+
python-3.10.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.8.12
1+
python-3.8.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.9.12
1+
python-3.9.0

0 commit comments

Comments
 (0)