mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Add API tests for both donut on disk and donut cache
This commit is contained in:
@@ -155,13 +155,12 @@ func (b bucket) ListObjects(prefix, marker, delimiter string, maxkeys int) (List
|
||||
}
|
||||
var prefixes []string
|
||||
var filteredObjects []string
|
||||
filteredObjects = objects
|
||||
if strings.TrimSpace(delimiter) != "" {
|
||||
filteredObjects = HasNoDelimiter(objects, delimiter)
|
||||
prefixes = HasDelimiter(objects, delimiter)
|
||||
prefixes = SplitDelimiter(prefixes, delimiter)
|
||||
prefixes = SortU(prefixes)
|
||||
} else {
|
||||
filteredObjects = objects
|
||||
}
|
||||
var results []string
|
||||
var commonPrefixes []string
|
||||
|
||||
@@ -34,15 +34,15 @@ func getDonutConfigPath() (string, error) {
|
||||
return donutConfigPath, nil
|
||||
}
|
||||
|
||||
// NOTE - this is not to be used outside Donut package, this is primarily intended for testing purposes only
|
||||
var customConfigPath string
|
||||
// NOTE - this is not thread safe use it carefully, currently its purpose is only for testing purposes.
|
||||
var CustomConfigPath string
|
||||
|
||||
// SaveConfig save donut config
|
||||
func SaveConfig(a *Config) error {
|
||||
var donutConfigPath string
|
||||
var err error
|
||||
if customConfigPath != "" {
|
||||
donutConfigPath = customConfigPath
|
||||
if CustomConfigPath != "" {
|
||||
donutConfigPath = CustomConfigPath
|
||||
} else {
|
||||
donutConfigPath, err = getDonutConfigPath()
|
||||
if err != nil {
|
||||
@@ -63,8 +63,8 @@ func SaveConfig(a *Config) error {
|
||||
func LoadConfig() (*Config, error) {
|
||||
var donutConfigPath string
|
||||
var err error
|
||||
if customConfigPath != "" {
|
||||
donutConfigPath = customConfigPath
|
||||
if CustomConfigPath != "" {
|
||||
donutConfigPath = CustomConfigPath
|
||||
} else {
|
||||
donutConfigPath, err = getDonutConfigPath()
|
||||
if err != nil {
|
||||
|
||||
@@ -66,7 +66,7 @@ func (s *MyDonutSuite) SetUpSuite(c *C) {
|
||||
conf.DonutName = "test"
|
||||
conf.NodeDiskMap = createTestNodeDiskMap(root)
|
||||
conf.MaxSize = 100000
|
||||
customConfigPath = filepath.Join(root, "donut.json")
|
||||
CustomConfigPath = filepath.Join(root, "donut.json")
|
||||
err = SaveConfig(conf)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
|
||||
@@ -500,13 +500,12 @@ func (donut API) ListObjects(bucket string, resources BucketResourcesMetadata) (
|
||||
}
|
||||
var prefixes []string
|
||||
var filteredKeys []string
|
||||
filteredKeys = keys
|
||||
if strings.TrimSpace(resources.Delimiter) != "" {
|
||||
filteredKeys = HasNoDelimiter(keys, resources.Delimiter)
|
||||
prefixes = HasDelimiter(keys, resources.Delimiter)
|
||||
prefixes = SplitDelimiter(prefixes, resources.Delimiter)
|
||||
prefixes = SortU(prefixes)
|
||||
} else {
|
||||
filteredKeys = keys
|
||||
}
|
||||
for _, commonPrefix := range prefixes {
|
||||
resources.CommonPrefixes = append(resources.CommonPrefixes, resources.Prefix+commonPrefix)
|
||||
|
||||
@@ -44,7 +44,7 @@ func (s *MyCacheSuite) SetUpSuite(c *C) {
|
||||
c.Assert(err, IsNil)
|
||||
s.root = root
|
||||
|
||||
customConfigPath = filepath.Join(root, "donut.json")
|
||||
CustomConfigPath = filepath.Join(root, "donut.json")
|
||||
dc, err = New()
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user