storj / gateway-st

Single-tenant, S3-compatible server to interact with the Storj network
Apache License 2.0
71 stars 19 forks source link

GetObjectTagging is not keeping tags list order #79

Open mniewrzal opened 8 months ago

mniewrzal commented 8 months ago

Minio implementation is encoding GetObjectTagging results without keeping the same order as input keys. It's not a big problem but because of that some ceph tests are flaky (e.g. test_get_obj_tagging). Test to describe issue:

func TestTags(t *testing.T) {
    tt, err := tags.NewTags(map[string]string{
        "0": "0",
        "1": "1",
    }, true)
    require.NoError(t, err)

    var bytesBuffer bytes.Buffer
    e := xml.NewEncoder(&bytesBuffer)
    err = e.Encode(tt)
    require.NoError(t, err)

    require.Equal(t, "<Tagging><TagSet><Tag><Key>0</Key><Value>0</Value></Tag><Tag><Key>1</Key><Value>1</Value></Tag></TagSet></Tagging>", bytesBuffer.String())
}

https://github.com/storj/minio/blob/main/cmd/object-handlers.go#L3555