Skip to content

Tests: Add additional log output to the editable package tests #1253

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

Merged
merged 1 commit into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ require:
AllCops:
NewCops: enable

Layout/TrailingWhitespace:
# Required since we use heredocs to assert against Hatchet output, and sometimes that output
# contains trailing newlines which we must match against. The alternative is to end the lines
# with the unsightly `#{' '}` workaround.
AllowInHeredoc: true

Metrics/BlockLength:
Enabled: false

Expand Down
4 changes: 3 additions & 1 deletion spec/fixtures/requirements_editable/bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ set -euo pipefail

BUILD_DIR="${1}"

exec "${BUILD_DIR}/bin/test-entrypoints"
cd "${BUILD_DIR}"

exec bin/test-entrypoints
4 changes: 4 additions & 0 deletions spec/fixtures/requirements_editable/bin/test-entrypoints
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -euo pipefail

# List the filenames and contents of all .egg-link and .pth files in site-packages.
find .heroku/python/lib*/*/site-packages/ -type f -and \( -name '*.egg-link' -or -name '*.pth' \) | sort | xargs -exec tail -n +1
echo

echo -n "Running entrypoint for the local package: "
local_package

Expand Down
2 changes: 1 addition & 1 deletion spec/hatchet/django_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
remote: Traceback \\(most recent call last\\):
remote: .*
remote: ModuleNotFoundError: No module named 'gettingstarted'
remote:#{' '}
remote:
remote: ! Error while running '\\$ python manage.py collectstatic --noinput'.
REGEX
end
Expand Down
58 changes: 54 additions & 4 deletions spec/hatchet/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
let(:buildpacks) { [:default, 'heroku-community/inline'] }
let(:app) { Hatchet::Runner.new('spec/fixtures/requirements_editable', buildpacks: buildpacks) }

it 'rewrites .pth paths correctly for hooks, later buildpacks, runtime and cached builds' do
it 'rewrites .pth and .egg-link paths correctly for hooks, later buildpacks, runtime and cached builds' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
remote: -----> Installing requirements with pip
Expand All @@ -103,18 +103,48 @@
remote: Running setup.py develop for local-package
remote: Successfully installed gunicorn local-package
remote: -----> Running post-compile hook
remote: ==> .heroku/python/lib/python.*/site-packages/easy-install.pth <==
remote: /app/.heroku/src/gunicorn
remote: /tmp/build_.*/local_package
remote:
remote: ==> .heroku/python/lib/python.*/site-packages/gunicorn.egg-link <==
remote: /app/.heroku/src/gunicorn
remote: .
remote: ==> .heroku/python/lib/python.*/site-packages/local-package.egg-link <==
remote: /tmp/build_.*/local_package
remote: .
remote: Running entrypoint for the local package: Hello!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
remote: -----> Inline app detected
remote: ==> .heroku/python/lib/python.*/site-packages/easy-install.pth <==
remote: /app/.heroku/src/gunicorn
remote: /app/local_package
remote:
remote: ==> .heroku/python/lib/python.*/site-packages/gunicorn.egg-link <==
remote: /app/.heroku/src/gunicorn
remote: .
remote: ==> .heroku/python/lib/python.*/site-packages/local-package.egg-link <==
remote: /tmp/build_.*/local_package
remote: .
remote: Running entrypoint for the local package: Hello!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
REGEX

# Test rewritten paths work at runtime.
expect(app.run('bin/test-entrypoints')).to include(<<~OUTPUT)
expect(app.run('bin/test-entrypoints')).to match(Regexp.new(<<~REGEX))
==> .heroku/python/lib/python.*/site-packages/easy-install.pth <==
/app/.heroku/src/gunicorn
/app/local_package

==> .heroku/python/lib/python.*/site-packages/gunicorn.egg-link <==
/app/.heroku/src/gunicorn
.
==> .heroku/python/lib/python.*/site-packages/local-package.egg-link <==
/tmp/build_.*/local_package
.
Running entrypoint for the local package: Hello!
Running entrypoint for the VCS package: gunicorn (version 20.1.0)
OUTPUT
Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
REGEX

# Test restoring paths in the cached .pth files works correctly.
app.commit!
Expand All @@ -137,9 +167,29 @@
remote: Running setup.py develop for local-package
remote: Successfully installed gunicorn local-package
remote: -----> Running post-compile hook
remote: ==> .heroku/python/lib/python.*/site-packages/easy-install.pth <==
remote: /tmp/build_.*/local_package
remote: /app/.heroku/src/gunicorn
remote:
remote: ==> .heroku/python/lib/python.*/site-packages/gunicorn.egg-link <==
remote: /app/.heroku/src/gunicorn
remote: .
remote: ==> .heroku/python/lib/python.*/site-packages/local-package.egg-link <==
remote: /tmp/build_.*/local_package
remote: .
remote: Running entrypoint for the local package: Hello!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
remote: -----> Inline app detected
remote: ==> .heroku/python/lib/python.*/site-packages/easy-install.pth <==
remote: /app/local_package
remote: /app/.heroku/src/gunicorn
remote:
remote: ==> .heroku/python/lib/python.*/site-packages/gunicorn.egg-link <==
remote: /app/.heroku/src/gunicorn
remote: .
remote: ==> .heroku/python/lib/python.*/site-packages/local-package.egg-link <==
remote: /tmp/build_.*/local_package
remote: .
remote: Running entrypoint for the local package: Hello!
remote: Running entrypoint for the VCS package: gunicorn \\(version 20.1.0\\)
REGEX
Expand Down