mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 22:46:16 +03:00
feat: Implement listing version 3.0 (#12605)
Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"sort"
|
||||
"testing"
|
||||
@@ -96,51 +95,6 @@ func Test_metaCacheEntries_merge(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_metaCacheEntries_dedupe(t *testing.T) {
|
||||
org := loadMetacacheSampleEntries(t)
|
||||
a, b := org.shallowClone(), org.shallowClone()
|
||||
|
||||
// Merge b into a
|
||||
a.merge(b, -1)
|
||||
if a.deduplicate(nil) {
|
||||
t.Fatal("deduplicate returned duplicate entries left")
|
||||
}
|
||||
want := loadMetacacheSampleNames
|
||||
got := a.entries().names()
|
||||
if !reflect.DeepEqual(want, got) {
|
||||
t.Errorf("got unexpected result: %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_metaCacheEntries_dedupe2(t *testing.T) {
|
||||
org := loadMetacacheSampleEntries(t)
|
||||
a, b := org.shallowClone(), org.shallowClone()
|
||||
|
||||
// Replace metadata in b
|
||||
testMarker := []byte("sampleset")
|
||||
for i := range b.o {
|
||||
b.o[i].metadata = testMarker
|
||||
}
|
||||
|
||||
// Merge b into a
|
||||
a.merge(b, -1)
|
||||
if a.deduplicate(func(existing, other *metaCacheEntry) (replace bool) {
|
||||
a := bytes.Equal(existing.metadata, testMarker)
|
||||
b := bytes.Equal(other.metadata, testMarker)
|
||||
if a == b {
|
||||
t.Fatal("got same number of testmarkers, only one should be given", a, b)
|
||||
}
|
||||
return b
|
||||
}) {
|
||||
t.Fatal("deduplicate returned duplicate entries left, we should always resolve")
|
||||
}
|
||||
want := loadMetacacheSampleNames
|
||||
got := a.entries().names()
|
||||
if !reflect.DeepEqual(want, got) {
|
||||
t.Errorf("got unexpected result: %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_metaCacheEntries_filterObjects(t *testing.T) {
|
||||
data := loadMetacacheSampleEntries(t)
|
||||
data.filterObjectsOnly()
|
||||
|
||||
Reference in New Issue
Block a user