diff options
Diffstat (limited to 'test/test_data.lua')
| -rw-r--r-- | test/test_data.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua index 4def123..74167bf 100644 --- a/test/test_data.lua +++ b/test/test_data.lua @@ -110,6 +110,27 @@ assert(fs[1].pct == 84, 'root percent, got ' .. tostring(fs[1].pct)) assert(fs[1].size == 263174213632, 'root size in bytes, got ' .. tostring(fs[1].size)) assert(fs[1].used == 208111570944, 'root used, got ' .. tostring(fs[1].used)) +-- Available is READ, never derived as size - used: the two differ by the +-- root-reserved blocks, about 5%, which on this root is some 13GB that exists +-- but cannot be used. A card claiming that space is free would be lying. +assert(fs[1].avail == 41746907136, 'root available, got ' .. tostring(fs[1].avail)) +assert(fs[1].size - fs[1].used ~= fs[1].avail, + 'the fixture must exercise the reserved-block gap, or this assertion proves nothing') + +-- fs[3] is /dev/sda1: a device name ENDING IN A DIGIT, next to a numeric +-- column. A parser counting fields from the left, or matching digits without +-- anchoring, reads the partition number as a size. +assert(fs[3].mount == '/data', 'sda1 mount, got ' .. tostring(fs[3].mount)) +assert(fs[3].dev == '/dev/sda1', 'sda1 device, got ' .. tostring(fs[3].dev)) +assert(fs[3].size == 983350091776, 'sda1 size, got ' .. tostring(fs[3].size)) +assert(fs[3].used == 547869650944, 'sda1 used, got ' .. tostring(fs[3].used)) +assert(fs[3].avail == 385453473792, 'sda1 available, got ' .. tostring(fs[3].avail)) +assert(fs[3].pct == 59, 'sda1 percent, got ' .. tostring(fs[3].pct)) +assert(fs[3].host == nil, 'a local device has no host') + +-- A full filesystem reports zero available, which is a real reading. +assert(fs[6].avail == 0, 'a full mount has 0 available, got ' .. tostring(fs[6].avail)) + -- The NFS rows are the reason the last field matters: a colon in the device -- would break a parser splitting on punctuation. assert(fs[4].mount == '/mnt/nfs/Library', 'nfs mount, got ' .. tostring(fs[4].mount)) |
