From 69ceb67ecdb97f5fe26b841b91a29b04beb1f07a Mon Sep 17 00:00:00 2001 From: Gianmaria Del Monte Date: Tue, 21 Feb 2023 09:52:33 +0100 Subject: [PATCH] fix linter --- pkg/ocm/storage/ocm.go | 11 ++++++----- tests/helpers/helpers.go | 4 +++- tests/integration/grpc/ocm_share_test.go | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/ocm/storage/ocm.go b/pkg/ocm/storage/ocm.go index 810f940a99..3351c68006 100644 --- a/pkg/ocm/storage/ocm.go +++ b/pkg/ocm/storage/ocm.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -68,6 +68,7 @@ func (c *config) init() { c.GatewaySVC = sharedconf.GetGatewaySVC(c.GatewaySVC) } +// New creates an OCM storage driver. func New(c map[string]interface{}) (storage.FS, error) { conf, err := parseConfig(c) if err != nil { @@ -273,8 +274,8 @@ func (d *driver) ListFolder(ctx context.Context, ref *provider.Reference, _ []st } func (d *driver) InitiateUpload(ctx context.Context, ref *provider.Reference, _ int64, _ map[string]string) (map[string]string, error) { - shareId, rel := shareInfoFromReference(ref) - p := getPathFromShareIDAndRelPath(shareId, rel) + shareID, rel := shareInfoFromReference(ref) + p := getPathFromShareIDAndRelPath(shareID, rel) return map[string]string{ "simple": p, @@ -301,10 +302,10 @@ func (d *driver) Download(ctx context.Context, ref *provider.Reference) (io.Read } func (d *driver) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error) { - shareId, rel := shareInfoFromReference(&provider.Reference{ + shareID, rel := shareInfoFromReference(&provider.Reference{ ResourceId: id, }) - return getPathFromShareIDAndRelPath(shareId, rel), nil + return getPathFromShareIDAndRelPath(shareID, rel), nil } func (d *driver) Shutdown(ctx context.Context) error { diff --git a/tests/helpers/helpers.go b/tests/helpers/helpers.go index fb8c9d3c13..7a7ab6f641 100644 --- a/tests/helpers/helpers.go +++ b/tests/helpers/helpers.go @@ -109,6 +109,7 @@ func Upload(ctx context.Context, fs storage.FS, ref *provider.Reference, content return err } +// UploadGateway uploads in one step a the content in a file. func UploadGateway(ctx context.Context, gw gatewayv1beta1.GatewayAPIClient, ref *provider.Reference, content []byte) error { res, err := gw.InitiateFileUpload(ctx, &provider.InitiateFileUploadRequest{ Ref: ref, @@ -146,7 +147,8 @@ func UploadGateway(ctx context.Context, gw gatewayv1beta1.GatewayAPIClient, ref return nil } -func Dowload(ctx context.Context, gw gatewayv1beta1.GatewayAPIClient, ref *provider.Reference) ([]byte, error) { +// Download downloads the content of a file in one step. +func Download(ctx context.Context, gw gatewayv1beta1.GatewayAPIClient, ref *provider.Reference) ([]byte, error) { res, err := gw.InitiateFileDownload(ctx, &provider.InitiateFileDownloadRequest{ Ref: ref, }) diff --git a/tests/integration/grpc/ocm_share_test.go b/tests/integration/grpc/ocm_share_test.go index 81e352a2b7..c8be79f7bc 100644 --- a/tests/integration/grpc/ocm_share_test.go +++ b/tests/integration/grpc/ocm_share_test.go @@ -246,7 +246,7 @@ var _ = Describe("ocm share", func() { PermissionSet: viewerPermissions, }) - data, err := helpers.Dowload(ctxMarie, cesnetgw, ref) + data, err := helpers.Download(ctxMarie, cesnetgw, ref) Expect(err).ToNot(HaveOccurred()) Expect(data).To(Equal([]byte("test"))) @@ -332,7 +332,7 @@ var _ = Describe("ocm share", func() { PermissionSet: editorPermissions, }) - data, err = helpers.Dowload(ctxMarie, cesnetgw, ref) + data, err = helpers.Download(ctxMarie, cesnetgw, ref) Expect(err).ToNot(HaveOccurred()) Expect(data).To(Equal([]byte("new-content")))