X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8e69317214ad56a6255f56725fa3b966c663eda3..9067fd12d2c4259a2988286663098c59af18c854:/services/keep/keep_test.go diff --git a/services/keep/keep_test.go b/services/keep/keep_test.go index 508e0cd5a0..05eb410dd6 100644 --- a/services/keep/keep_test.go +++ b/services/keep/keep_test.go @@ -37,10 +37,6 @@ var BAD_BLOCK = []byte("The magic words are squeamish ossifrage.") // - use an interface to mock ioutil.TempFile with a File // object that always returns an error on write // -// * TestNodeStatus -// - test that GetNodeStatus returns a structure with expected -// values: need to mock FreeDiskSpace or Statfs, or use a tmpfs -// // ======================================== // GetBlock tests. // ======================================== @@ -320,6 +316,35 @@ func TestIndex(t *testing.T) { } } +// TestNodeStatus +// Test that GetNodeStatus returns valid info about available volumes. +// +// TODO(twp): set up appropriate interfaces to permit more rigorous +// testing. +// +func TestNodeStatus(t *testing.T) { + defer teardown() + + // Set up test Keep volumes. + KeepVolumes = setup(t, 2) + + // Get node status and make a basic sanity check. + st := GetNodeStatus() + for i, vol := range KeepVolumes { + volinfo := st.Volumes[i] + mtp := volinfo.MountPoint + if mtp != vol { + t.Errorf("GetNodeStatus mount_point %s != KeepVolume %s", mtp, vol) + } + if volinfo.BytesFree == 0 { + t.Errorf("uninitialized bytes_free in %v", volinfo) + } + if volinfo.BytesUsed == 0 { + t.Errorf("uninitialized bytes_used in %v", volinfo) + } + } +} + // ======================================== // Helper functions for unit tests. // ========================================