[ARVADOS] updated: 43748be08c5d67171cb2f5565670dd0eef889b07
git at public.curoverse.com
git at public.curoverse.com
Tue Sep 22 18:27:50 EDT 2015
Summary of changes:
.../keepstore_integration_unix_volume_test.go | 113 ---------------------
services/keepstore/keepstore_test.go | 38 -------
services/keepstore/volume_unix_test.go | 59 -----------
3 files changed, 210 deletions(-)
delete mode 100644 services/keepstore/keepstore_integration_unix_volume_test.go
via 43748be08c5d67171cb2f5565670dd0eef889b07 (commit)
from 87892d98eac028934480c378748cfb65a780d1cc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 43748be08c5d67171cb2f5565670dd0eef889b07
Author: radhika <radhika at curoverse.com>
Date: Tue Sep 22 18:25:53 2015 -0400
7329: since moved functional testing into generic testing, removing now redundant empty block tests from volume_unix_test.go and keepstore_test.go.
diff --git a/services/keepstore/keepstore_integration_unix_volume_test.go b/services/keepstore/keepstore_integration_unix_volume_test.go
deleted file mode 100644
index affbe9d..0000000
--- a/services/keepstore/keepstore_integration_unix_volume_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package main
-
-import (
- "bytes"
- "os"
- "testing"
-
- "git.curoverse.com/arvados.git/sdk/go/arvadostest"
-)
-
-func SetupKeepStoreUnixVolumeIntegrationTest(t *testing.T) {
- os.Setenv("ARVADOS_API_HOST_INSECURE", "true")
-
- // Set up Keep unix volumes
- KeepVM = MakeTestUnixVolumeManager(t, 2)
- defer KeepVM.Close()
-
- // Start api and keep servers
- arvadostest.StartAPI()
- arvadostest.StartKeep()
-}
-
-// MakeTestUnixVolumeManager returns a RRVolumeManager
-// with the specified number of UnixVolumes.
-var testableUnixVols []*TestableUnixVolume
-
-func MakeTestUnixVolumeManager(t *testing.T, numVolumes int) VolumeManager {
- vols := make([]Volume, numVolumes)
- testableUnixVols = make([]*TestableUnixVolume, numVolumes)
-
- for i := range vols {
- v := NewTestableUnixVolume(t, false, false)
- vols[i] = v
- testableUnixVols[i] = v
- }
- return MakeRRVolumeManager(vols)
-}
-
-// Put TestBlock and Get it
-func TestPutTestBlock(t *testing.T) {
- SetupKeepStoreUnixVolumeIntegrationTest(t)
-
- // Check that PutBlock succeeds
- if err := PutBlock(TestBlock, TestHash); err != nil {
- t.Fatalf("Error during PutBlock: %s", err)
- }
-
- // Check that PutBlock succeeds again even after CompareAndTouch
- if err := PutBlock(TestBlock, TestHash); err != nil {
- t.Fatalf("Error during PutBlock: %s", err)
- }
-
- // Check that PutBlock stored the data as expected
- buf, err := GetBlock(TestHash)
- if err != nil {
- t.Fatalf("Error during GetBlock for %q: %s", TestHash, err)
- } else if bytes.Compare(buf, TestBlock) != 0 {
- t.Errorf("Get response incorrect. Expected %q; found %q", TestBlock, buf)
- }
-}
-
-// UnixVolume -> Compare is falling in infinite loop since EOF is not being
-// returned by reader.Read() for empty block resulting in issue #7329.
-// Hence invoke PutBlock twice to test that path involving CompareAndTouch
-func TestPutEmptyBlock(t *testing.T) {
- SetupKeepStoreUnixVolumeIntegrationTest(t)
-
- // Check that PutBlock succeeds
- if err := PutBlock(EmptyBlock, EmptyHash); err != nil {
- t.Fatalf("Error during PutBlock: %s", err)
- }
-
- // Check that PutBlock succeeds again even after CompareAndTouch
- // With #7329 unresovled, this falls in infinite loop in UnixVolume -> Compare method
- if err := PutBlock(EmptyBlock, EmptyHash); err != nil {
- t.Fatalf("Error during PutBlock: %s", err)
- }
-
- // Check that PutBlock stored the data as expected
- buf, err := GetBlock(EmptyHash)
- if err != nil {
- t.Fatalf("Error during GetBlock for %q: %s", EmptyHash, err)
- } else if bytes.Compare(buf, EmptyBlock) != 0 {
- t.Errorf("Get response incorrect. Expected %q; found %q", EmptyBlock, buf)
- }
-}
-
-// PutRaw EmptyHash with bad data (which bypasses hash check)
-// and then invoke PutBlock with the correct EmptyBlock.
-// Put should succeed and next Get should return EmptyBlock
-func TestPutEmptyBlockDiskHashError(t *testing.T) {
- SetupKeepStoreUnixVolumeIntegrationTest(t)
-
- badEmptyBlock := []byte("verybaddata")
-
- // Put bad data for EmptyHash in both volumes
- testableUnixVols[0].PutRaw(EmptyHash, badEmptyBlock)
- testableUnixVols[1].PutRaw(EmptyHash, badEmptyBlock)
-
- // Check that PutBlock with good data succeeds
- if err := PutBlock(EmptyBlock, EmptyHash); err != nil {
- t.Fatalf("Error during PutBlock for %q: %s", EmptyHash, err)
- }
-
- // Put succeeded and overwrote the badEmptyBlock in one volume,
- // and Get should return the EmptyBlock now, ignoring the bad data.
- buf, err := GetBlock(EmptyHash)
- if err != nil {
- t.Fatalf("Error during GetBlock for %q: %s", EmptyHash, err)
- } else if bytes.Compare(buf, EmptyBlock) != 0 {
- t.Errorf("Get response incorrect. Expected %q; found %q", TestBlock, buf)
- }
-}
diff --git a/services/keepstore/keepstore_test.go b/services/keepstore/keepstore_test.go
index 7a882e0..0e2129c 100644
--- a/services/keepstore/keepstore_test.go
+++ b/services/keepstore/keepstore_test.go
@@ -418,44 +418,6 @@ func TestIndex(t *testing.T) {
}
}
-// TestKeepStoreGetEmptyBlock
-func TestKeepStoreGetEmptyBlock(t *testing.T) {
- defer teardown()
-
- // Prepare two mock volumes
- KeepVM = MakeTestVolumeManager(2)
- defer KeepVM.Close()
-
- vols := KeepVM.AllWritable()
- if err := vols[0].Put(EmptyHash, EmptyBlock); err != nil {
- t.Error("Error putting empty block: %s", err)
- }
-
- // Check that GetBlock returns success.
- result, err := GetBlock(EmptyHash)
- if err != nil {
- t.Errorf("Get error for empty hash: %s", err)
- }
- if bytes.Compare(result, EmptyBlock) != 0 {
- t.Errorf("Get response incorrect. Expected %q; found %q", EmptyBlock, result)
- }
-}
-
-// TestKeepStoreGetEmptyBlockNotExists that does not exist
-func TestKeepStoreGetEmptyBlockNotExists(t *testing.T) {
- defer teardown()
-
- // Prepare two mock volumes
- KeepVM = MakeTestVolumeManager(2)
- defer KeepVM.Close()
-
- // Check that GetBlock returns error.
- _, err := GetBlock(EmptyHash)
- if err == nil {
- t.Errorf("Expected error when getting non-existing empty block")
- }
-}
-
// ========================================
// Helper functions for unit tests.
// ========================================
diff --git a/services/keepstore/volume_unix_test.go b/services/keepstore/volume_unix_test.go
index 4fd6a30..dd6214d 100644
--- a/services/keepstore/volume_unix_test.go
+++ b/services/keepstore/volume_unix_test.go
@@ -309,65 +309,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
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list