Steal tests from other branch that is being discarded, attempt to get at least one of them to pass; WIP

This commit is contained in:
Dane Everitt
2020-09-30 21:46:32 -07:00
parent 0f7bb1a371
commit 9b7c0fb7f3
6 changed files with 613 additions and 33 deletions

View File

@@ -199,7 +199,18 @@ func (fs *Filesystem) hasSpaceFor(size int64) error {
// Updates the disk usage for the Filesystem instance.
func (fs *Filesystem) addDisk(i int64) int64 {
size, _ := fs.DiskUsage(true)
var size = atomic.LoadInt64(&fs.diskUsed)
// Sorry go gods. This is ugly but the best approach I can come up with for right
// now without completely re-evaluating the logic we use for determining disk space.
//
// Normally I would just be using the atomic load right below, but I'm not sure about
// the scenarios where it is 0 because nothing has run that would trigger a disk size
// calculation?
//
// Perhaps that isn't even a concern for the sake of this?
if !fs.isTest {
size, _ = fs.DiskUsage(true)
}
// If we're dropping below 0 somehow just cap it to 0.
if (size + i) < 0 {