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

Support testing buildpacks compiled in release mode #456

Merged
merged 1 commit into from
Jul 6, 2022

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Jul 6, 2022

Previously libcnb-test only supported compiling the buildpack under test using Cargo's dev profile.

Now, TestConfig::cargo_profile can be used along with CargoProfile to instruct libcnb-package to compile the buildpack using Cargo's release mode (equivalent to --release).

The TestConfig default profile remains CargoProfile::Dev as before.

This:

  • Allows buildpack maintainers to opt into release mode, if their buildpack's tests happen to run particularly slowly in debug mode. Whilst release builds take longer, in some cases this is vastly offset by the faster runtime performance of release builds (particularly when the compilation cache is warm).
  • (As an added bonus) Could help in the future should we encounter any "release mode only" compiler related bugs, where being able to easily run integration tests in release mode would be invaluable.

An integration test has not been added, since:

  • There is no easy way to determine in the test whether the buildpack was actually built in release mode or not (we don't expose the cargo build logs).
  • The integration test would be the only one in this repo to run in release mode, so would add to the end to end time due to it having a cold compilation cache, and also bloat the CI cache (due to there being a mix of debug+release builds; something that people using release mode long-term in their own buildpack are unlikely to do).
  • Most of this change has coverage via the type system + TestConfig::cargo_profile rustdoc example.
  • The release mode is not new, and is already exercised via libcnb-cargo.

Fixes #386.
GUS-W-10912497.

@edmorley edmorley self-assigned this Jul 6, 2022
@edmorley edmorley added the documentation Improvements or additions to documentation label Jul 6, 2022
@edmorley edmorley marked this pull request as ready for review July 6, 2022 17:06
@edmorley edmorley requested a review from a team as a code owner July 6, 2022 17:06
Previously `libcnb-test` only supported compiling the buildpack
under test using Cargo's `dev` profile.

Now, `TestConfig::cargo_profile` can be used along with `CargoProfile`
to instruct `libcnb-package` to compile the buildpack using Cargo's
`release` mode (equivalent to `--release`).

The `TestConfig` default profile remains `CargoProfile::Dev` as before.

This:
- Allows buildpack maintainers to opt into release mode, if their
  buildpack's tests happen to run particularly slowly in debug mode.
  Whilst release builds take longer, in some cases this is vastly offset
  by the faster runtime performance of release builds (particularly when
  the compilation cache is warm).
- Could help in the future should we encounter any "release mode only"
  compiler related bugs, where being able to easily run integration tests
  in release mode would be invaluable.

An integration test has not been added, since:
- There is no easy way to determine in the test whether the buildpack was
  actually built in release mode or not (we don't expose the Cargo logs).
- Most of this change has coverage via the type system.
- The release mode is not new, and is already exercised via `libcnb-cargo`.

Fixes #386.
GUS-W-10912497.
@edmorley edmorley force-pushed the edmorley/libcnb-test-release-mode branch from 53ffc28 to d0c0c46 Compare July 6, 2022 19:09
@edmorley edmorley enabled auto-merge (squash) July 6, 2022 19:11
@edmorley edmorley merged commit 2550475 into main Jul 6, 2022
@edmorley edmorley deleted the edmorley/libcnb-test-release-mode branch July 6, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request libcnb-package libcnb-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libcnb-test: Support compiling buildpacks with --release
2 participants