(t *testing.T)
| 30 | ) |
| 31 | |
| 32 | func TestFsToFsStats(t *testing.T) { |
| 33 | inodes := uint64(100) |
| 34 | inodesFree := uint64(50) |
| 35 | testCases := map[string]struct { |
| 36 | fs *fs.Fs |
| 37 | expected info.FsStats |
| 38 | }{ |
| 39 | "has_inodes": { |
| 40 | fs: &fs.Fs{ |
| 41 | DeviceInfo: fs.DeviceInfo{Device: "123"}, |
| 42 | Type: fs.VFS, |
| 43 | Capacity: uint64(1024 * 1024), |
| 44 | Free: uint64(1024), |
| 45 | Available: uint64(1024), |
| 46 | Inodes: &inodes, |
| 47 | InodesFree: &inodesFree, |
| 48 | DiskStats: fs.DiskStats{ |
| 49 | ReadsCompleted: uint64(100), |
| 50 | ReadsMerged: uint64(100), |
| 51 | SectorsRead: uint64(100), |
| 52 | ReadTime: uint64(100), |
| 53 | WritesCompleted: uint64(100), |
| 54 | WritesMerged: uint64(100), |
| 55 | SectorsWritten: uint64(100), |
| 56 | WriteTime: uint64(100), |
| 57 | IoInProgress: uint64(100), |
| 58 | IoTime: uint64(100), |
| 59 | WeightedIoTime: uint64(100), |
| 60 | }, |
| 61 | }, |
| 62 | expected: info.FsStats{ |
| 63 | Device: "123", |
| 64 | Type: fs.VFS.String(), |
| 65 | Limit: uint64(1024 * 1024), |
| 66 | Usage: uint64(1024*1024) - uint64(1024), |
| 67 | HasInodes: true, |
| 68 | Inodes: inodes, |
| 69 | InodesFree: inodesFree, |
| 70 | Available: uint64(1024), |
| 71 | ReadsCompleted: uint64(100), |
| 72 | ReadsMerged: uint64(100), |
| 73 | SectorsRead: uint64(100), |
| 74 | ReadTime: uint64(100), |
| 75 | WritesCompleted: uint64(100), |
| 76 | WritesMerged: uint64(100), |
| 77 | SectorsWritten: uint64(100), |
| 78 | WriteTime: uint64(100), |
| 79 | IoInProgress: uint64(100), |
| 80 | IoTime: uint64(100), |
| 81 | WeightedIoTime: uint64(100), |
| 82 | }, |
| 83 | }, |
| 84 | "has_no_inodes": { |
| 85 | fs: &fs.Fs{ |
| 86 | DeviceInfo: fs.DeviceInfo{Device: "123"}, |
| 87 | Type: fs.DeviceMapper, |
| 88 | Capacity: uint64(1024 * 1024), |
| 89 | Free: uint64(1024), |
nothing calls this directly
no test coverage detected
searching dependent graphs…