Test Coverage PR-1: Tests added in ./licensecheck and ./repodata subdir#231
Open
mohanmanikanta2299 wants to merge 3 commits into
Open
Test Coverage PR-1: Tests added in ./licensecheck and ./repodata subdir#231mohanmanikanta2299 wants to merge 3 commits into
mohanmanikanta2299 wants to merge 3 commits into
Conversation
CreatorHead
reviewed
Jun 3, 2026
| // Header should come before original content | ||
| headerIdx := lo.IndexOf([]byte(string(content)), []byte(header)[0]) | ||
| contentIdx := lo.IndexOf([]byte(string(content)), []byte(originalContent)[0]) | ||
| assert.Less(t, headerIdx, contentIdx) |
Contributor
There was a problem hiding this comment.
Hey @mohanmanikanta2299, I changed header to just "C" in the "add header to file with existing content" sub-test and the test still passed. Please take a look and review the PR properly before sending it for review.
aatish@aatish-CLPJCQ9LWW copywrite % go test ./licensecheck/ -run "TestAddHeader/add_header_to_file_with_existing_content" -v -count=1
=== RUN TestAddHeader
=== RUN TestAddHeader/add_header_to_file_with_existing_content
--- PASS: TestAddHeader (0.00s)
--- PASS: TestAddHeader/add_header_to_file_with_existing_content (0.00s)
PASS
ok github.com/hashicorp/copywrite/licensecheck 0.971s
Contributor
There was a problem hiding this comment.
@mohanmanikanta2299 , please enable co-pilot review as well, it will help saving some time in review from other Devs.
Collaborator
Author
There was a problem hiding this comment.
Addressed the concern.
Thanks
CreatorHead
requested changes
Jun 3, 2026
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.

🛠️ Description
Summary
This PR is the 1st part of the test coverage PRs intended to increase the test coverage of the entire repo from 55% to 80+%, fulfilling our coverage requirements.
Changes Made
./licensecheckand./repodatapackages.assert.Equal,assert.Contains) and explicit error checking to validate function outputs and edge cases.requirefor critical initializations (like loggers and flag lookups) to prevent nil-pointer panics during test execution.Testing
go test -v ./...(All tests passing)go test -race ./...(No race conditions detected)🔗 External Links
https://hashicorp.atlassian.net/browse/CCEN-512
👍 Definition of Done
🤔 Can be merged upon approval?
✅
PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.