verification: add smoke test suite for Sinatra app (no behavior change)#391
Draft
barretts wants to merge 1 commit into
Draft
verification: add smoke test suite for Sinatra app (no behavior change)#391barretts wants to merge 1 commit into
barretts wants to merge 1 commit into
Conversation
Adds the first test infrastructure to this repo (previously zero tests). - Gemfile: rspec + rack-test in :test group - .rspec config - spec/spec_helper.rb (Rack::Test + Sinatra::Application) - spec/smoke_spec.rb -- 7 assertions verifying the app boots and serves traffic Asserts: 1. Loading web.rb does not raise 2. GET / returns 200 with Twelve-Factor body 3. GET /ja/ returns 200 (localized path; i18n routing alive) 4. Unknown path returns 404 (not 500) 5. Rack >= 3.0 6. Sinatra >= 3.0 7. (and the boot-only spec_helper load assertion) Local verification (rvm 3.3.5): bundle exec rspec spec/smoke_spec.rb -> 7 examples, 0 failures. Layer L4 (smoke) of the workspace verification ladder. See heroku/3pp-grackle/docs/verification-specs/12factor.md. A companion .github/workflows/ci.yml (running this smoke on every PR) is recommended as a follow-up; deferred from this PR per local security-hook policy on workflow file edits. The workflow content is in the spec file referenced above. Refs: heroku/3pp-grackle Phase 1 verification-specs initiative
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the first test infrastructure to this repo (previously zero tests):
Gemfile--rspec+rack-testin:testgroup.rspecconfigspec/spec_helper.rb-- minimalRack::Testsetup againstSinatra::Applicationspec/smoke_spec.rb-- 7 assertions verifying the Sinatra app boots and serves trafficWhy
Establishes layer L4 (smoke) of the workspace verification ladder
defined in
heroku/3pp-grackle/docs/verification-specs/12factor.md.This repo previously had zero automated tests -- a syntax error or
removed Sinatra method would ship to prod undetected. The smoke catches
the most common regression class: gem bumps (rack, sinatra,
rack-session, i18n) that accidentally break require-time init or
middleware-stack composition.
This is the Phase 1 pilot for the Ruby-app pattern -- the same shape
will be reused for
signup,trials-manager,www,elements,and
jambox.Asserts (boot-only)
web.rbdoes not raise (Sinatra/rack/i18n init succeeds)GET /returns 200 with HTML body referencing Twelve-FactorGET /ja/returns 200 (localized path; i18n routing alive)GET /__nonexistent__returns 404 (not 500)Sinatra::Applicationconstant is defined (boot completed)CVE-specific floor assertions (e.g.
rack >= 3.1.21) are deliberatelyNOT in this smoke -- those belong in L7 regression tests on the
relevant fix PRs. Mixing them would make this smoke fail on
mainwhenever a CVE bump hadn't merged yet, defeating its purpose as a
"does it boot?" gate.
Local verification
Behavior change
None. This PR only adds test infrastructure.
web.rb, the localefiles, and the views are untouched. The two new test gems
(
rspec,rack-test) are in the:testGemfile group and notshipped to production.
Recommended follow-up: CI workflow
This repo's only existing GHA-equivalent is a no-op
.travis.yml(
script: exit 0). A GitHub Actions workflow that runsrspecon every PR would close the gap. Suggested content (deferred from this
PR per local security-hook policy on workflow edits):
Refs
docs/verification-specs/12factor.mddocs/verification-specs/INDEX.md