Skip to content

Commit

Permalink
fix: the watcher incorrectly parsed massif numbers (#15)
Browse files Browse the repository at this point in the history
It parsed them from the blob path as hex. They are simple decimal
counters.

AB#9541

Co-authored-by: Robin Bryce <[email protected]>
  • Loading branch information
robinbryce and Robin Bryce authored May 28, 2024
1 parent bb9cb07 commit 6f1dd29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion massifs/pathparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ParseMassifPathNumberExt(path string) (uint32, string, error) {
if parts[1] != V1MMRMassifExt && parts[1] != V1MMRSealSignedRootExt {
return 0, "", fmt.Errorf("%w: extension invalid %s", ErrMassifPathFmt, path)
}
number, err := strconv.ParseUint(parts[0], 16, 32)
number, err := strconv.ParseUint(parts[0], 10, 32)
if err != nil {
return 0, "", fmt.Errorf("%w: log file number invalid %s (%v)", ErrMassifPathFmt, path, err)
}
Expand Down
8 changes: 7 additions & 1 deletion massifs/pathparse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ func TestParseMassifPathNumberExt(t *testing.T) {
want1 string
wantErr bool
}{
// TODO: Add test cases.
{
"decimal / hex confusion",
args{"v1/mmrs/tenant/84e0e9e9-d479-4d4e-9e8c-afc19a8fc185/0/massifs/0000000000000051.log"},
51,
"log",
false,
},
{
"happy case",
args{"v1/mmrs/tenant/84e0e9e9-d479-4d4e-9e8c-afc19a8fc185/0/massifs/0000000000000002.log"},
Expand Down

0 comments on commit 6f1dd29

Please sign in to comment.