[#194] s3local: Fix bucket resolver should not use zone
All checks were successful
DCO action / DCO (pull_request) Successful in 26s
Tests and linters / Tests with -race (pull_request) Successful in 2m1s
Tests and linters / Tests (pull_request) Successful in 2m8s
Tests and linters / Lint (pull_request) Successful in 2m18s

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2025-01-24 12:30:13 +03:00
parent ebbc5bc0a7
commit d05ad5d3c5
2 changed files with 6 additions and 7 deletions

View file

@ -5,7 +5,6 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/data"
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/api/layer"
v2container "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container"
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
"git.frostfs.info/TrueCloudLab/xk6-frostfs/internal/datagen"
"git.frostfs.info/TrueCloudLab/xk6-frostfs/internal/local"
@ -18,7 +17,7 @@ type Client struct {
vu modules.VU
l *layer.Layer
ownerID *user.ID
resolver layer.BucketResolver
resolver fixedBucketResolver
limiter local.Limiter
}
@ -43,7 +42,7 @@ func (c *Client) Put(bucket, key string, payload datagen.Payload) PutResponse {
Error: "engine size limit reached",
}
}
cid, err := c.resolver.Resolve(c.vu.Context(), v2container.SysAttributeZoneDefault, bucket)
cid, err := c.resolver.Resolve(c.vu.Context(), "", bucket)
if err != nil {
stats.Report(c.vu, objPutFails, 1)
return PutResponse{Error: err.Error()}
@ -79,7 +78,7 @@ func (c *Client) Put(bucket, key string, payload datagen.Payload) PutResponse {
}
func (c *Client) Get(bucket, key string) GetResponse {
cid, err := c.resolver.Resolve(c.vu.Context(), v2container.SysAttributeZoneDefault, bucket)
cid, err := c.resolver.Resolve(c.vu.Context(), "", bucket)
if err != nil {
stats.Report(c.vu, objGetFails, 1)
return GetResponse{Error: err.Error()}

View file

@ -24,9 +24,9 @@ func newFixedBucketResolver(bucketMapping map[string]string) (fixedBucketResolve
return r, nil
}
func (r fixedBucketResolver) Resolve(_ context.Context, zone, bucket string) (cid.ID, error) {
if cnrID, resolved := r[zone+"/"+bucket]; resolved {
func (r fixedBucketResolver) Resolve(_ context.Context, _, bucket string) (cid.ID, error) {
if cnrID, resolved := r[bucket]; resolved {
return cnrID, nil
}
return cid.ID{}, fmt.Errorf("zone %s and bucket %s is not mapped to any container", zone, bucket)
return cid.ID{}, fmt.Errorf("bucket %s is not mapped to any container", bucket)
}