|
|
@ -124,17 +124,10 @@ func TestGetCacheFSMaxUse(t *testing.T) { |
|
|
|
|
|
|
|
|
|
|
|
// test wildcard patterns for excluding entries from cache
|
|
|
|
// test wildcard patterns for excluding entries from cache
|
|
|
|
func TestCacheExclusion(t *testing.T) { |
|
|
|
func TestCacheExclusion(t *testing.T) { |
|
|
|
fsDirs, err := getRandomDisks(1) |
|
|
|
cobjects := &cacheObjects{ |
|
|
|
if err != nil { |
|
|
|
cache: nil, |
|
|
|
t.Fatal(err) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
cconfig := CacheConfig{Expiry: 30, Drives: fsDirs} |
|
|
|
|
|
|
|
cobjects, err := newServerCacheObjects(cconfig) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
t.Fatal(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cobj := cobjects.(*cacheObjects) |
|
|
|
|
|
|
|
GlobalServiceDoneCh <- struct{}{} |
|
|
|
|
|
|
|
testCases := []struct { |
|
|
|
testCases := []struct { |
|
|
|
bucketName string |
|
|
|
bucketName string |
|
|
|
objectName string |
|
|
|
objectName string |
|
|
@ -155,8 +148,8 @@ func TestCacheExclusion(t *testing.T) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for i, testCase := range testCases { |
|
|
|
for i, testCase := range testCases { |
|
|
|
cobj.exclude = []string{testCase.excludePattern} |
|
|
|
cobjects.exclude = []string{testCase.excludePattern} |
|
|
|
if cobj.isCacheExclude(testCase.bucketName, testCase.objectName) != testCase.expectedResult { |
|
|
|
if cobjects.isCacheExclude(testCase.bucketName, testCase.objectName) != testCase.expectedResult { |
|
|
|
t.Fatal("Cache exclusion test failed for case ", i) |
|
|
|
t.Fatal("Cache exclusion test failed for case ", i) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|