mirror of
https://github.com/minio/minio.git
synced 2025-11-20 09:56:07 -05:00
Add GetObjectNInfo to object layer (#6449)
The new call combines GetObjectInfo and GetObject, and returns an object with a ReadCloser interface. Also adds a number of end-to-end encryption tests at the handler level.
This commit is contained in:
committed by
Harshavardhana
parent
7d0645fb3a
commit
36e51d0cee
@@ -17,6 +17,8 @@
|
||||
package ioutil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
goioutil "io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -73,3 +75,29 @@ func TestAppendFile(t *testing.T) {
|
||||
t.Errorf("AppendFile() failed, expected: %s, got %s", expected, string(b))
|
||||
}
|
||||
}
|
||||
|
||||
func TestSkipReader(t *testing.T) {
|
||||
testCases := []struct {
|
||||
src io.Reader
|
||||
skipLen int64
|
||||
expected string
|
||||
}{
|
||||
{bytes.NewBuffer([]byte("")), 0, ""},
|
||||
{bytes.NewBuffer([]byte("")), 1, ""},
|
||||
{bytes.NewBuffer([]byte("abc")), 0, "abc"},
|
||||
{bytes.NewBuffer([]byte("abc")), 1, "bc"},
|
||||
{bytes.NewBuffer([]byte("abc")), 2, "c"},
|
||||
{bytes.NewBuffer([]byte("abc")), 3, ""},
|
||||
{bytes.NewBuffer([]byte("abc")), 4, ""},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
r := NewSkipReader(testCase.src, testCase.skipLen)
|
||||
b, err := goioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
t.Errorf("Case %d: Unexpected err %v", i, err)
|
||||
}
|
||||
if string(b) != testCase.expected {
|
||||
t.Errorf("Case %d: Got wrong result: %v", i, string(b))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user