[#195] Fix lint errors

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-03-02 09:19:01 +03:00 committed by Angira Kekteeva
parent 77f90ca7c5
commit 5c530123ab
3 changed files with 5 additions and 17 deletions

View file

@ -130,7 +130,7 @@ func prepareTestRequest(t *testing.T, bktName, objName string, body interface{})
require.NoError(t, err) require.NoError(t, err)
w := httptest.NewRecorder() w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodPut, defaultUrl, bytes.NewReader(rawBody)) r := httptest.NewRequest(http.MethodPut, defaultURL, bytes.NewReader(rawBody))
reqInfo := api.NewReqInfo(w, r, api.ObjectRequest{Bucket: bktName, Object: objName}) reqInfo := api.NewReqInfo(w, r, api.ObjectRequest{Bucket: bktName, Object: objName})
r = r.WithContext(api.SetReqInfo(r.Context(), reqInfo)) r = r.WithContext(api.SetReqInfo(r.Context(), reqInfo))

View file

@ -17,7 +17,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
const defaultUrl = "http://localhost/" const defaultURL = "http://localhost/"
func TestFormObjectLock(t *testing.T) { func TestFormObjectLock(t *testing.T) {
for _, tc := range []struct { for _, tc := range []struct {
@ -63,7 +63,7 @@ func TestFormObjectLock(t *testing.T) {
name: "invalid time format error", name: "invalid time format error",
bktInfo: &data.BucketInfo{ObjectLockEnabled: true}, bktInfo: &data.BucketInfo{ObjectLockEnabled: true},
header: map[string][]string{ header: map[string][]string{
api.AmzObjectLockRetainUntilDate: {time.Now().Format(time.Layout)}, api.AmzObjectLockRetainUntilDate: {time.Now().Format(time.RFC822)},
}, },
expectedError: true, expectedError: true,
}, },
@ -351,7 +351,7 @@ func TestPutBucketLockConfigurationHandler(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
w := httptest.NewRecorder() w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodPut, defaultUrl, bytes.NewReader(body)) r := httptest.NewRequest(http.MethodPut, defaultURL, bytes.NewReader(body))
r = r.WithContext(api.SetReqInfo(r.Context(), api.NewReqInfo(w, r, api.ObjectRequest{Bucket: tc.bucket}))) r = r.WithContext(api.SetReqInfo(r.Context(), api.NewReqInfo(w, r, api.ObjectRequest{Bucket: tc.bucket})))
hc.Handler().PutBucketObjectLockConfigHandler(w, r) hc.Handler().PutBucketObjectLockConfigHandler(w, r)
@ -425,7 +425,7 @@ func TestGetBucketLockConfigurationHandler(t *testing.T) {
} { } {
t.Run(tc.name, func(t *testing.T) { t.Run(tc.name, func(t *testing.T) {
w := httptest.NewRecorder() w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodPut, defaultUrl, bytes.NewReader(nil)) r := httptest.NewRequest(http.MethodPut, defaultURL, bytes.NewReader(nil))
r = r.WithContext(api.SetReqInfo(r.Context(), api.NewReqInfo(w, r, api.ObjectRequest{Bucket: tc.bucket}))) r = r.WithContext(api.SetReqInfo(r.Context(), api.NewReqInfo(w, r, api.ObjectRequest{Bucket: tc.bucket})))
hc.Handler().GetBucketObjectLockConfigHandler(w, r) hc.Handler().GetBucketObjectLockConfigHandler(w, r)

View file

@ -398,18 +398,6 @@ func contains(list []string, elem string) bool {
return false return false
} }
func objectInfoToBucketSettings(info *data.ObjectInfo) *data.BucketSettings {
res := &data.BucketSettings{}
enabled, ok := info.Headers[attrSettingsVersioningEnabled]
if ok {
if parsed, err := strconv.ParseBool(enabled); err == nil {
res.VersioningEnabled = parsed
}
}
return res
}
func (n *layer) checkVersionsExist(ctx context.Context, bkt *data.BucketInfo, obj *VersionedObject) (*data.ObjectInfo, error) { func (n *layer) checkVersionsExist(ctx context.Context, bkt *data.BucketInfo, obj *VersionedObject) (*data.ObjectInfo, error) {
versions, err := n.headVersions(ctx, bkt, obj.Name) versions, err := n.headVersions(ctx, bkt, obj.Name)
if err != nil { if err != nil {