func TestDirectoryCommon(t *testing.T) { ds, tmpDir := makeTestingDirectory(t) defer os.RemoveAll(tmpDir) defer ds.Close() storetests.TestStore(t, ds) shouldHashcheck(t, ds, 0, 0) }
func TestCacheGeneric(t *testing.T) { for size := 1; size <= 1024*128; size *= 4 { inner := storetests.NewMockStore(0) cache := New(size, inner) storetests.TestStore(t, cache) cache.assertUsedIsCorrect() } }
func TestDirectoryCommonSmallSplit(t *testing.T) { ds, tmpDir := makeTestingDirectory(t) defer os.RemoveAll(tmpDir) defer ds.Close() ds.mu.Lock() ds.minSplitSize = 2 ds.maxSplitSize = 4 ds.mu.Unlock() storetests.TestStore(t, ds) shouldHashcheck(t, ds, 0, 0) }
func TestHTTPCommon(t *testing.T) { mock := storetests.NewMockStore(0) srv := httptest.NewServer(NewServer(mock)) defer srv.Close() client, err := NewClient(srv.URL + "/") if err != nil { t.Fatalf("Couldn't initialize client: %v", err) } storetests.TestStore(t, client) if client.UUID() != mock.UUID() { t.Errorf("client UUID %v does not match directory UUID %v", uuid.Fmt(client.UUID()), uuid.Fmt(mock.UUID())) } }
func TestMultiCommon(t *testing.T) { _, multi, _, done := prepareMultiTest(t, 2, 3, 4) defer done() storetests.TestStore(t, multi) }