Beispiel #1
0
func TestBlobsFileBackendWithSmallMaxBlobsFileSize(t *testing.T) {
	b := New("./tmp_blobsfile_test_small", 512, false, false)
	//check(err)
	defer b.Close()
	defer os.RemoveAll("./tmp_blobsfile_test_small")
	backend.Test(t, b)
}
Beispiel #2
0
func TestBlobsFileBackend(t *testing.T) {
	b := New("./tmp_blobsfile_test", 0, false, false)
	//check(err)
	defer b.Close()
	defer os.RemoveAll("./tmp_blobsfile_test")
	backend.Test(t, b)
}
Beispiel #3
0
func TestBlobsFileBackendWithCompression(t *testing.T) {
	b := New("./tmp_blobsfile_test_compressed", 0, true, false)
	//check(err)
	defer b.Close()
	defer os.RemoveAll("./tmp_blobsfile_test_compressed")
	backend.Test(t, b)
}
Beispiel #4
0
func TestMirrorBackend(t *testing.T) {
	dest1 := blobsfile.New("tmp_blobsfile_1", 0, false, false)
	defer os.RemoveAll("tmp_blobsfile_1")
	dest2 := blobsfile.New("tmp_blobsfile_2", 0, false, false)
	defer os.RemoveAll("tmp_blobsfile_2")
	b := New([]backend.BlobHandler{dest1, dest2}, []backend.BlobHandler{})
	backend.Test(t, b)
}
Beispiel #5
0
func TestBlobsFileBackendCloseAndReopen(t *testing.T) {
	b := New("./tmp_blobsfile_test_reopen", 0, false, false)
	//check(err)
	defer os.RemoveAll("./tmp_blobsfile_test_reopen")
	backend.Test(t, b)
	b.Close()
	b2 := New("./tmp_blobsfile_test_reopen", 0, false, false)
	backend.TestReadOnly(t, b2)
}
Beispiel #6
0
func TestBlobsFileBackendCloseAndReopenAndReindexCompressed(t *testing.T) {
	b := New("./tmp_blobsfile_test_reindexc", 0, true, false)
	//check(err)
	defer os.RemoveAll("./tmp_blobsfile_test_reindexc")
	backend.Test(t, b)
	b.Close()
	b.Remove()
	b2 := New("./tmp_blobsfile_test_reindexc", 0, true, false)
	backend.TestReadOnly(t, b2)
}
Beispiel #7
0
func TestEncryptBackend(t *testing.T) {
	dest := blobsfile.New("tmp_blobsfile_enc", 0, false, false)
	defer os.RemoveAll("tmp_blobsfile_enc")
	gopath := os.Getenv("GOPATH")
	if gopath == "" {
		panic("GOPATH env variable not set")
	}
	keyPath := filepath.Join(gopath, "src/github.com/tsileo/blobstash/test/data/key.testkey")
	b := New(keyPath, dest)
	backend.Test(t, b)
}
Beispiel #8
0
func TestS3Backend(t *testing.T) {
	if os.Getenv("S3_TEST_BUCKET") == "" || os.Getenv("S3_ACCESS_KEY") == "" || os.Getenv("S3_SECRET_KEY") == "" {
		t.Skip("Skipping TestS3Backend, environment variable S3_TEST_BUCKET/S3_ACCESS_KEY/S3_SECRET_KEY not set.")
	}
	b := New(os.Getenv("S3_TEST_BUCKET"), "eu-west-1")
	defer func() {
		if err := b.Drop(); err != nil {
			panic(err)
		}
	}()
	backend.Test(t, b)
}