|
|
|
@ -24,7 +24,7 @@ var file_ref1 = swampfile.FileReference{"/path1", "ns1"}
|
|
|
|
|
var file_ref2 = swampfile.FileReference{"/path1", "ns2"}
|
|
|
|
|
var file_ref3 = swampfile.FileReference{"/path2", "ns1"}
|
|
|
|
|
|
|
|
|
|
func NewTestSwampFileService() SwampFileService {
|
|
|
|
|
func NewTestDataSwampService() DataSwampService {
|
|
|
|
|
file_repo := m_swampfile.NewRepository()
|
|
|
|
|
ns_repo := m_namespace.NewRepository()
|
|
|
|
|
|
|
|
|
@ -37,12 +37,12 @@ func NewTestSwampFileService() SwampFileService {
|
|
|
|
|
1024,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return *NewSwampFileService(*ns_svc, file_repo, logger)
|
|
|
|
|
return *NewDataSwampService(*ns_svc, file_repo, logger)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestFileDontExist(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
outfile, err := s.OpenOutFile(file_ref1)
|
|
|
|
|
|
|
|
|
|
is.True(err == swampfile.ErrNotExists)
|
|
|
|
@ -51,7 +51,7 @@ func TestFileDontExist(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestFileIsStored(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
|
|
|
|
|
fakefile := bytes.NewBufferString("My bog data")
|
|
|
|
|
|
|
|
|
@ -72,7 +72,7 @@ func TestFileIsStored(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestFileIsReadBack(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
|
|
|
|
|
infile := bytes.NewBufferString("My bog data")
|
|
|
|
|
|
|
|
|
@ -88,7 +88,7 @@ func TestFileIsReadBack(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestNSIsolation(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
|
|
|
|
|
ns1_file := bytes.NewBufferString("My bog data ns1")
|
|
|
|
|
ns2_file := bytes.NewBufferString("My bog data ns2")
|
|
|
|
@ -106,7 +106,7 @@ func TestNSIsolation(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestPathStrictMode(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
|
|
|
|
|
ns_file := bytes.NewBufferString("My bog data ns1")
|
|
|
|
|
|
|
|
|
@ -126,7 +126,7 @@ func TestPathStrictMode(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestQuotaWithContenSizeLieOver(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
|
|
|
|
|
largefakefile := bytes.NewBufferString("")
|
|
|
|
|
|
|
|
|
@ -141,7 +141,7 @@ func TestQuotaWithContenSizeLieOver(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestQuotaWithContenSizeLieUnder(t *testing.T) {
|
|
|
|
|
is := is.New(t)
|
|
|
|
|
s := NewTestSwampFileService()
|
|
|
|
|
s := NewTestDataSwampService()
|
|
|
|
|
|
|
|
|
|
largefakefile := bytes.NewBufferString("small")
|
|
|
|
|
|
|
|
|
@ -165,7 +165,7 @@ func TestCleanUpExpired(t *testing.T) {
|
|
|
|
|
1024,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
s := NewSwampFileService(*ns_svc, file_repo, logger)
|
|
|
|
|
s := NewDataSwampService(*ns_svc, file_repo, logger)
|
|
|
|
|
|
|
|
|
|
fakefile := bytes.NewBufferString("My bog")
|
|
|
|
|
err := s.SaveFile(file_ref1, fakefile, int64(fakefile.Len()))
|
|
|
|
|