Example #1
0
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)
}
Example #2
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()
	}
}
Example #3
0
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)
}
Example #4
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()))
	}
}
Example #5
0
func TestMultiCommon(t *testing.T) {
	_, multi, _, done := prepareMultiTest(t, 2, 3, 4)
	defer done()
	storetests.TestStore(t, multi)
}