mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
fix : IAM Intialization failing with a large number of users/policies (#11701)
This commit is contained in:
39
cmd/iam-etcd-store_test.go
Normal file
39
cmd/iam-etcd-store_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* MinIO Cloud Storage, (C) 2016 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestExtractPrefixAndSuffix(t *testing.T) {
|
||||
specs := []struct {
|
||||
path, prefix, suffix string
|
||||
expected string
|
||||
}{
|
||||
{"config/iam/groups/foo.json", "config/iam/groups/", ".json", "foo"},
|
||||
{"config/iam/groups/./foo.json", "config/iam/groups/", ".json", "foo"},
|
||||
{"config/iam/groups/foo/config.json", "config/iam/groups/", "/config.json", "foo"},
|
||||
{"config/iam/groups/foo/config.json", "config/iam/groups/", "config.json", "foo"},
|
||||
}
|
||||
for i, test := range specs {
|
||||
result := extractPathPrefixAndSuffix(test.path, test.prefix, test.suffix)
|
||||
if result != test.expected {
|
||||
t.Errorf("unexpected result on test[%v]: expected[%s] but had [%s]", i, test.expected, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user