feat(testing): add e2e test for release init workflow#2033
feat(testing): add e2e test for release init workflow#2033jinseopkim0 merged 10 commits intomainfrom
Conversation
c967a54 to
38c777d
Compare
2b4bc99 to
c202d6b
Compare
This commit introduces an end-to-end test for the 'librarian release init' command. The test verifies that the command correctly updates the state.yaml file and generates a CHANGELOG.md based on a mock repository and a simulated feature commit. The test utilizes a mock container behavior defined in testdata/e2e_func.go, which processes a release-init-request.json file as per the Librarian container contract.
This refactors the TestReleaseInit end-to-end test to use a table-driven structure. This improves the readability and maintainability of the test, and makes it easier to add new test cases in the future.
31c4535 to
bf202a8
Compare
bf202a8 to
b0d7207
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2033 +/- ##
==========================================
+ Coverage 82.16% 83.23% +1.07%
==========================================
Files 83 84 +1
Lines 8848 9198 +350
==========================================
+ Hits 7270 7656 +386
+ Misses 1230 1197 -33
+ Partials 348 345 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Updates the mock commit message in TestReleaseInit to use the
footer keys ('git-commit-hash', 'PiperOrigin-RevId') expected by the
conventional commits parser to populate source_commit_hash and
piper_cl_number in release-init-request.json.
Also ensures that the validation within the e2e_func mock checks
for the presence of these fields, hardening the test against regressions
like issue #2066 and issue #2035.
- Change log level from Debug to Info in e2e_func.go - Remove redundant debug log statement - Use constant for release init response filename - Remove unused 'release' field from updated-state.yaml to align with schema
Updates the e2e test for 'release init' to use a more realistic, complex commit message that includes nested commits. Updates the golden CHANGELOG.md to match the expected output from the new commit message. Note: The test is expected to fail until the commit parser is fixed to correctly handle nested commits. This is part of an active effort being worked on separately.
6e2e670 to
bde0dde
Compare
Thanks for pointing that out. I was using the parameter "git-commit-hash" instead of "Source-Link" footer in the commit message. I've fixed this (by using a real commit message googleapis/google-cloud-java@cea98dc as the input for the test), and the test fails as expected. I've updated the description of this PR to include: This issue is being tracked in #2066. |
Sub-task for #1013.
This PR adds E2E test for the
release initworkflow.The tests verify that the command updates the
state.yamlfile and generatesCHANGELOG.mdcorrectly by comparing them with golden files.Importantly, this PR enhances the tests to validate the structure and content of the
release-init-request.jsonfile that is generated by thelibrariantool based on mock Git commits. This validation ensures the generated JSON conforms to the container contract as defined indoc/language-onboarding.md.This enhanced test coverage will prevent regressions of the following issues:
type,subject,body) are used in thechangesarray, preventing contract mismatches.piper_cl_numberandsource_commit_hashfields are present, ensuring commit trailers are parsed and included correctly.Note: The test fails until internal/conventionalcommits/conventional_commits.go is updated to handle the parsing correctly.
This issue is being tracked in #2066.