Merge branch 'master' into 7200-keepproxy-index-api
[arvados.git] / services / keepstore / volume_unix_test.go
index 4fd6a30e63b9181266b7deb298a313a54ec48653..924637f58e5004f1cec307266c87c0b53ae81d03 100644 (file)
@@ -86,8 +86,8 @@ func TestUnixVolumeWithGenericTestsSerialized(t *testing.T) {
 }
 
 // serialize = false; readonly = false
-func TestUnixVolumeManagerWithGenericTests(t *testing.T) {
-       DoGenericVolumeFunctionalTests(t, func(t *testing.T) []TestableVolume {
+func TestUnixVolumeHandlersWithGenericVolumeTests(t *testing.T) {
+       DoHandlersWithGenericVolumeTests(t, func(t *testing.T) (*RRVolumeManager, []TestableVolume) {
                vols := make([]Volume, 2)
                testableUnixVols := make([]TestableVolume, 2)
 
@@ -97,9 +97,7 @@ func TestUnixVolumeManagerWithGenericTests(t *testing.T) {
                        testableUnixVols[i] = v
                }
 
-               KeepVM = MakeRRVolumeManager(vols)
-
-               return testableUnixVols
+               return MakeRRVolumeManager(vols), testableUnixVols
        })
 }
 
@@ -309,65 +307,6 @@ func TestUnixVolumeCompare(t *testing.T) {
        }
 }
 
-// Put an EmptyBlock and get and compare for EmptyHash
-// With #7329 unresolved, Compare falls in infinite loop
-func TestGetAndCompareEmptyBlock(t *testing.T) {
-       v := NewTestableUnixVolume(t, false, false)
-       defer v.Teardown()
-
-       v.Put(EmptyHash, EmptyBlock)
-
-       buf, err := v.Get(EmptyHash)
-       if err != nil {
-               t.Errorf("Error during Get for %q: %s", EmptyHash, err)
-       }
-
-       err = v.Compare(EmptyHash, buf)
-       if err != nil {
-               t.Errorf("Error during Compare for %q: %s", EmptyHash, err)
-       }
-}
-
-// Put baddata for EmptyHash. Get will succeed, but Compare will raise DiskHashError
-func TestGetAndCompareEmptyHashWithDiskHashError(t *testing.T) {
-       v := NewTestableUnixVolume(t, false, false)
-       defer v.Teardown()
-
-       v.PutRaw(EmptyHash, []byte("baddata"))
-
-       _, err := v.Get(EmptyHash)
-       if err != nil {
-               t.Errorf("Unexpected error after PutRaw EmptyHash with baddata")
-       }
-
-       err = v.Compare(EmptyHash, EmptyBlock)
-       if err != DiskHashError {
-               t.Errorf("Expected DiskHashError when comparing EmptyHash with bad data. Got %s", err)
-       }
-}
-
-// Get non existing empty block; should fail with file not found error.
-func TestGetEmptyBlockNonExisting(t *testing.T) {
-       v := NewTestableUnixVolume(t, false, false)
-       defer v.Teardown()
-
-       buf, err := v.Get(EmptyHash)
-       if err == nil {
-               t.Errorf("Get non existing empty hash should have failed, instead got %q", buf)
-       }
-}
-
-// Compare non existing empty hash should fail with file not found error.
-func TestCompareEmptyHashNonExisting(t *testing.T) {
-       v := NewTestableUnixVolume(t, false, false)
-       defer v.Teardown()
-
-       err := v.Compare(EmptyHash, EmptyBlock)
-       if err == nil {
-               t.Errorf("Expected error no such file. But got no error.")
-       }
-}
-
 // TODO(twp): show that the underlying Read/Write operations executed
 // serially and not concurrently. The easiest way to do this is
 // probably to activate verbose or debug logging, capture log output