mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Merge pull request #297 from fkautz/pr_out_more_testing
This commit is contained in:
commit
e601d997f3
@ -59,12 +59,15 @@ func (donutMem donutMem) CreateBucket(b string) error {
|
||||
donutMem.buckets[b] = &newBucket
|
||||
return nil
|
||||
}
|
||||
|
||||
func (donutMem donutMem) ListObjects(bucket, prefix string) ([]string, error) {
|
||||
return nil, errors.New("Not Implemented")
|
||||
}
|
||||
|
||||
func (donutMem donutMem) GetBucketMetadata(bucket, name string) (io.Reader, error) {
|
||||
return nil, errors.New("Not Implemented")
|
||||
}
|
||||
|
||||
func (donutMem donutMem) SetBucketMetadata(bucket, name string, metadata io.Reader) error {
|
||||
return errors.New("Not Implemented")
|
||||
}
|
||||
@ -117,6 +120,7 @@ func (donutMem donutMem) GetObjectWriter(bucket, key string, column uint, blockS
|
||||
writer.CloseWithError(errors.New("Bucket does not exist"))
|
||||
return writer
|
||||
}
|
||||
|
||||
func (donutMem donutMem) GetObjectReader(bucket, key string, column int) (io.Reader, error) {
|
||||
donutMem.lock.RLock()
|
||||
defer donutMem.lock.RUnlock()
|
||||
@ -132,9 +136,11 @@ func (donutMem donutMem) GetObjectReader(bucket, key string, column int) (io.Rea
|
||||
}
|
||||
return nil, errors.New("Bucket not found")
|
||||
}
|
||||
|
||||
func (donutMem donutMem) StoreObjectMetadata(bucket, object, name string, reader io.Reader) error {
|
||||
return errors.New("Not Implemented")
|
||||
}
|
||||
|
||||
func (donutMem donutMem) GetObjectMetadata(bucket, object, name string) (io.Reader, error) {
|
||||
return nil, errors.New("Not Implemented")
|
||||
}
|
||||
|
@ -28,13 +28,29 @@ func (s *MySuite) TestAPISuite(c *C) {
|
||||
count, err = writer.Write([]byte(data))
|
||||
c.Assert(count, Equals, len(data))
|
||||
c.Assert(err, IsNil)
|
||||
writer.Close()
|
||||
err = writer.Close()
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// time.Sleep(1 * time.Second)
|
||||
|
||||
// data should be available
|
||||
reader, err := donut.GetObjectReader("foo", "bar", 0)
|
||||
c.Assert(err, IsNil)
|
||||
result, err := ioutil.ReadAll(reader)
|
||||
c.Assert(result, DeepEquals, []byte(data))
|
||||
|
||||
// try writing, should see error
|
||||
writer = donut.GetObjectWriter("foo", "bar", 0, 2)
|
||||
count, err = writer.Write([]byte("different data"))
|
||||
c.Assert(count, Equals, 0)
|
||||
c.Assert(err, Not(IsNil))
|
||||
// try again, should see error
|
||||
count, err = writer.Write([]byte("different data"))
|
||||
c.Assert(count, Equals, 0)
|
||||
c.Assert(err, Not(IsNil))
|
||||
|
||||
// data should not change
|
||||
reader, err = donut.GetObjectReader("foo", "bar", 0)
|
||||
c.Assert(err, IsNil)
|
||||
result, err = ioutil.ReadAll(reader)
|
||||
c.Assert(result, DeepEquals, []byte(data))
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user