Skip to content

Fix intermittent profile.d/ scripts test failure from extra trailing newline#2102

Merged
edmorley merged 1 commit into
mainfrom
edmorley/fix-flaky-profile-d-newline
Jun 8, 2026
Merged

Fix intermittent profile.d/ scripts test failure from extra trailing newline#2102
edmorley merged 1 commit into
mainfrom
edmorley/fix-flaky-profile-d-newline

Conversation

@edmorley

@edmorley edmorley commented Jun 8, 2026

Copy link
Copy Markdown
Member

The profile.d/ scripts test asserts on captured run_multi command output using an exact match against a heredoc. The platform log stream that captures the output occasionally appends an extra trailing newline, which intermittently breaks these exact assertions.

For example:
https://github.com/heroku/heroku-buildpack-python/actions/runs/27144980449/job/80156740097?pr=2099#step:5:628

Failures:

  1) .profile.d/ scripts sets the required run-time env vars
     Failure/Error:
       expect(output).to eq(<<~OUTPUT)
         Python buildpack: Detected 512 MB available memory and 8 CPU cores.
         Python buildpack: Skipping automatic configuration of WEB_CONCURRENCY since it's already set.
         DYNO_RAM=512
         WEB_CONCURRENCY=999
       OUTPUT

       expected: "Python buildpack: Detected 512 MB available memory and 8 CPU cores.\nPython buildpack: Skipping auto...matic configuration of WEB_CONCURRENCY since it's already set.\nDYNO_RAM=512\nWEB_CONCURRENCY=999\n"
            got: "Python buildpack: Detected 512 MB available memory and 8 CPU cores.\nPython buildpack: Skipping auto...tic configuration of WEB_CONCURRENCY since it's already set.\nDYNO_RAM=512\nWEB_CONCURRENCY=999\n\n"

       (compared using ==)
     # ./spec/hatchet/profile_d_scripts_spec.rb:128:in 'block (4 levels) in <top (required)>'
     # ./vendor/bundle/ruby/4.0.0/gems/heroku_hatchet-8.0.6/lib/hatchet/app.rb:255:in 'block in Hatchet::App#run_multi'

Adds a normalize_trailing_newlines spec helper that collapses any trailing newlines down to a single one, and applies it to the exact-match assertions in the test. This absorbs the spurious trailing newline whilst still asserting on the rest of the output exactly.

GUS-W-22900269.

…newline

The profile.d/ scripts test asserts on captured `run_multi` command output
using an exact match against a heredoc. The platform log stream that captures
the output occasionally appends an extra trailing newline, which intermittently
breaks these exact assertions.

For example:
https://github.com/heroku/heroku-buildpack-python/actions/runs/27144980449/job/80156740097?pr=2099#step:5:628

```
Failures:

  1) .profile.d/ scripts sets the required run-time env vars
     Failure/Error:
       expect(output).to eq(<<~OUTPUT)
         Python buildpack: Detected 512 MB available memory and 8 CPU cores.
         Python buildpack: Skipping automatic configuration of WEB_CONCURRENCY since it's already set.
         DYNO_RAM=512
         WEB_CONCURRENCY=999
       OUTPUT

       expected: "Python buildpack: Detected 512 MB available memory and 8 CPU cores.\nPython buildpack: Skipping auto...matic configuration of WEB_CONCURRENCY since it's already set.\nDYNO_RAM=512\nWEB_CONCURRENCY=999\n"
            got: "Python buildpack: Detected 512 MB available memory and 8 CPU cores.\nPython buildpack: Skipping auto...tic configuration of WEB_CONCURRENCY since it's already set.\nDYNO_RAM=512\nWEB_CONCURRENCY=999\n\n"

       (compared using ==)
     # ./spec/hatchet/profile_d_scripts_spec.rb:128:in 'block (4 levels) in <top (required)>'
     # ./vendor/bundle/ruby/4.0.0/gems/heroku_hatchet-8.0.6/lib/hatchet/app.rb:255:in 'block in Hatchet::App#run_multi'
```

Adds a `normalize_trailing_newlines` spec helper that collapses any trailing
newlines down to a single one, and applies it to the exact-match assertions in
the test. This absorbs the spurious trailing newline whilst still asserting on
the rest of the output exactly.

GUS-W-22900269.
@edmorley edmorley self-assigned this Jun 8, 2026
@edmorley edmorley marked this pull request as ready for review June 8, 2026 17:51
@edmorley edmorley requested a review from a team as a code owner June 8, 2026 17:51
@edmorley edmorley enabled auto-merge (squash) June 8, 2026 17:52
@edmorley edmorley merged commit ccc4d5e into main Jun 8, 2026
7 of 8 checks passed
@edmorley edmorley deleted the edmorley/fix-flaky-profile-d-newline branch June 8, 2026 17:58
@heroku-linguist heroku-linguist Bot mentioned this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants