Skip to content

Conversation

@julio-lopez
Copy link
Collaborator

  • extend unit test cases for additional units
  • refactor tests

@julio-lopez julio-lopez requested a review from Copilot July 2, 2025 01:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends byte unit support to include petabyte (P) and exabyte (E) prefixes and refactors the existing unit tests to use testify/require with table-driven t.Run subtests.

  • Added “P” and “E” to both base10UnitPrefixes and base2UnitPrefixes
  • Changed test value types from int64 to uint64, expanded test cases to cover PB and EB
  • Switched tests to require.Equal and split TestBytesString into two env-based subtests with t.Run

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/units/units.go Extended base10UnitPrefixes and base2UnitPrefixes to include “P” and “E”
internal/units/units_test.go Refactored unit tests: use fmt + require, convert to uint64, add subtests, cover PB/EB
Comments suppressed due to low confidence (3)

internal/units/units_test.go:103

  • [nitpick] Test function names are mixed between camelCase and snake_case. Consider renaming to TestBytesStringBase2EnvFalse for consistency with other test names.
func TestBytesString_base2EnvFalse(t *testing.T) {

internal/units/units_test.go:114

  • [nitpick] For consistency with existing test names, consider renaming to TestBytesStringBase2EnvTrue instead of using an underscore.
func TestBytesString_base2EnvTrue(t *testing.T) {

internal/units/units_test.go:66

  • This entry duplicates the earlier {1000000000000, "0.9 TiB"} case. Please remove the redundant test row to avoid confusion.
	{1000000000000, "0.9 TiB"},

@codecov
Copy link

codecov bot commented Jul 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.41%. Comparing base (cb455c6) to head (c6c81c2).
Report is 594 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4707      +/-   ##
==========================================
+ Coverage   75.86%   76.41%   +0.54%     
==========================================
  Files         470      530      +60     
  Lines       37301    40373    +3072     
==========================================
+ Hits        28299    30850    +2551     
- Misses       7071     7488     +417     
- Partials     1931     2035     +104     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@julio-lopez julio-lopez marked this pull request as ready for review July 2, 2025 01:38
@julio-lopez julio-lopez merged commit 347adbf into kopia:master Jul 2, 2025
30 of 31 checks passed
@julio-lopez julio-lopez deleted the fix/pb-eb-units branch July 2, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant