Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
gmgigi96 committed Feb 21, 2023
1 parent 8d83dac commit 69ceb67
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions pkg/ocm/storage/ocm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion tests/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
})
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/grpc/ocm_share_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")))

Expand Down Expand Up @@ -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")))

Expand Down

0 comments on commit 69ceb67

Please sign in to comment.