Skip to content

test(internal/tools/verifyreadmes): add unit tests for verifyReadme#8066

Open
marcschaeferger wants to merge 1 commit intoopen-telemetry:mainfrom
marcschaeferger:unit-test-verifyreadmes
Open

test(internal/tools/verifyreadmes): add unit tests for verifyReadme#8066
marcschaeferger wants to merge 1 commit intoopen-telemetry:mainfrom
marcschaeferger:unit-test-verifyreadmes

Conversation

@marcschaeferger
Copy link
Contributor

This PR adds unit tests for the verifyreadmes tool.

The tests target the verifyReadme function in
internal/tools/verifyreadmes/main.go, which is responsible for ensuring
that each Go module directory contains a README.md.

Test coverage includes:

  • propagation of incoming errors from filepath.Walk
  • ignoring files that are not go.mod
  • ignoring paths located in excluded directories
  • successful validation when README.md exists alongside go.mod
  • returning the expected error when README.md is missing

The missing README test validates the exact error message rather than
only asserting the presence of an error, addressing review feedback from
the previous attempt in #7026.

No changes were made to production code. This PR only introduces tests.
--> So no need to update the Changelog?

The following commands were run without any issue.

cd internal/tools/ && go test ./verifyreadmes/...
make precommit 

Closes #6604

Signed-off-by: Marc Schäfer <git@marcschaeferger.de>
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.6%. Comparing base (7e13b02) to head (6a6219b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8066   +/-   ##
=====================================
  Coverage   81.6%   81.6%           
=====================================
  Files        304     304           
  Lines      23448   23448           
=====================================
+ Hits       19140   19141    +1     
+ Misses      3926    3925    -1     
  Partials     382     382           

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmathieu dmathieu added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for the verify readmes script

2 participants