Repository navigation
Conversation
DeleteVolume subtracts the volume's size from the cached total that TotalVolumeBytes reports to disk capacity tracking, but no test checked that the total goes back down after a delete.
This branch has not been deployed
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.
If
DeleteVolumestopped taking a volume's size off the running total, Hypeman would keep counting deleted volumes as used disk until a restart:/resourcesand instance admission would see too little free disk, and creates undermax_total_volume_storagewould be refused although the space was freed. No test would notice.Tests only: one test (+24 lines) in
lib/volumes/manager_test.go. No change to library code.TestDeleteVolume_ReleasesStoragecreates a 1 GB volume, checks thatTotalVolumeBytesreports it, deletes it, and checks that the total is back to 0.TotalVolumeBytesis documented as used by the resource manager for disk capacity tracking, and since #187 it is served from a cached total that create adds to and delete subtracts from.How it was checked
On main at 2455387,
go test -tags=containers_image_openpgp -count=1 ./lib/volumes ./lib/autostandby ./lib/imagepush ./lib/ocicachegc ./cmd/api/configpasses (229 tests, on a GitHub-hosted ubuntu-latest runner, no KVM or root). With them.subtractVolumeBytes(...)call removed fromDeleteVolume, this new test is the only one that fails.gofmtandgo vetare clean.This test was written with Claude Code during a planted-bug run by Saurabh (SK) @ Trenyx.
Note
Low Risk
Test-only change with no runtime behavior impact.
Overview
Adds
TestDeleteVolume_ReleasesStorageinlib/volumes/manager_test.goso coverage exists for disk accounting on delete.The test creates a 1 GiB volume, checks that
TotalVolumeBytesincludes it, deletes the volume, and expects the total back at 0. That path matters because the cached total drives/resourcesandmax_total_volume_storageadmission; ifDeleteVolumestopped callingsubtractVolumeBytes, freed space would stay booked until restart.Tests only — no production code changes.
Reviewed by Cursor Bugbot for commit d367bc1. Bugbot is set up for automated code reviews on this repo. Configure here.