forked from TrueCloudLab/frostfs-s3-gw
[#665] Prevent ContinuationToken duplication in ListObjectsV2 result
Signed-off-by: Aleksey Kravchenko <al.kravchenko@yadro.com>
This commit is contained in:
parent
646f59abfd
commit
c0c99a1839
2 changed files with 25 additions and 2 deletions
|
@ -938,6 +938,29 @@ func TestPeriodicWriter(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestListObjectsNotDuplicateContinuationToken(t *testing.T) {
|
||||
tc := prepareHandlerContext(t)
|
||||
|
||||
bktName := "bucket-for-listing"
|
||||
bktInfo := createTestBucket(tc, bktName)
|
||||
|
||||
for _, name := range []string{"bar /baz", "bar baz/foo", "bar/baz"} {
|
||||
createTestObject(tc, bktInfo, name, encryption.Params{})
|
||||
}
|
||||
|
||||
t.Run("list v2", func(t *testing.T) {
|
||||
res1 := listObjectsV2(tc, bktName, "", "", "", "", 1)
|
||||
res2 := listObjectsV2(tc, bktName, "", "", "", res1.NextContinuationToken, 1)
|
||||
require.NotEqual(t, res1.NextContinuationToken, res2.NextContinuationToken)
|
||||
})
|
||||
|
||||
t.Run("list versions", func(t *testing.T) {
|
||||
res1 := listObjectsVersions(tc, bktName, "", "", "", "", 1)
|
||||
res2 := listObjectsVersions(tc, bktName, "", "", res1.NextKeyMarker, res1.NextVersionIDMarker, 1)
|
||||
require.NotEqual(t, res1.NextVersionIDMarker, res2.NextVersionIDMarker)
|
||||
})
|
||||
}
|
||||
|
||||
func checkVersionsNames(t *testing.T, versions *ListObjectsVersionsResponse, names []string) {
|
||||
for i, v := range versions.Version {
|
||||
require.Equal(t, names[i], v.Key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue