Skip to content

Commit

Permalink
Add grpc integration tests for the ocis and the owncloud storage driv…
Browse files Browse the repository at this point in the history
…ers (#1514)
  • Loading branch information
aduffeck authored Mar 16, 2021
1 parent 56b9b5a commit 881b15e
Show file tree
Hide file tree
Showing 24 changed files with 1,573 additions and 241 deletions.
34 changes: 34 additions & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def main(ctx):
return [
buildAndPublishDocker(),
buildOnly(),
testIntegration(),
release(),
litmusOcisOldWebdav(),
litmusOcisNewWebdav(),
Expand Down Expand Up @@ -275,6 +276,39 @@ def buildOnly():
]
}

def testIntegration():
return {
"kind": "pipeline",
"type": "docker",
"name": "test-integration",
"platform": {
"os": "linux",
"arch": "amd64",
},
"trigger": {
"event": {
"include": [
"pull_request",
],
},
},
"steps": [
{
"name": "test",
"image": "registry.cern.ch/docker.io/library/golang:1.13",
"commands": [
"make test-integration",
],
"environment": {
"REDIS_ADDRESS": "redis:6379",
},
}
],
"services": [
redisService(),
],
}

def release():
return {
"kind": "pipeline",
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ build-reva: imports
go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva

test: off
go test -race ./...
go test -race $$(go list ./... | grep -v /tests/integration)

test-integration: build-ci
cd tests/integration && go test -race ./...

litmus-test-old: build
cd tests/oc-integration-tests/local && ../../../cmd/revad/revad -c frontend.toml &
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/add-grpc-testsuite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Add grpc test suite for the storage provider

A new test suite has been added which tests the grpc interface to the storage
provider. It currently runs against the ocis and the owncloud storage drivers.

https://github.com/cs3org/reva/pull/1514
220 changes: 0 additions & 220 deletions grpc-tests/userprovider_test.go

This file was deleted.

3 changes: 3 additions & 0 deletions pkg/storage/fs/owncloud/owncloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,9 @@ func (fs *ocfs) listShareFolderRoot(ctx context.Context, sp string, mdKeys []str

mds, err := ioutil.ReadDir(ip)
if err != nil {
if os.IsNotExist(err) {
return nil, errtypes.NotFound(fs.toStoragePath(ctx, filepath.Dir(ip)))
}
return nil, errors.Wrap(err, "ocfs: error listing shadow_files")
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/storage/utils/ace/ace.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,11 @@ func (e *ACE) Grant() *provider.Grant {
},
Permissions: e.grantPermissionSet(),
}
id := e.principal[2:]
if e.granteeType() == provider.GranteeType_GRANTEE_TYPE_GROUP {
g.Grantee.Id = &provider.Grantee_GroupId{GroupId: &grouppb.GroupId{OpaqueId: e.principal}}
g.Grantee.Id = &provider.Grantee_GroupId{GroupId: &grouppb.GroupId{OpaqueId: id}}
} else if e.granteeType() == provider.GranteeType_GRANTEE_TYPE_USER {
g.Grantee.Id = &provider.Grantee_UserId{UserId: &userpb.UserId{OpaqueId: e.principal}}
g.Grantee.Id = &provider.Grantee_UserId{UserId: &userpb.UserId{OpaqueId: id}}
}
return g
}
Expand Down Expand Up @@ -324,7 +325,7 @@ func unmarshalKV(s string) (*ACE, error) {
func getACEPerm(set *provider.ResourcePermissions) string {
var b strings.Builder

if set.Stat || set.InitiateFileDownload || set.ListContainer {
if set.Stat || set.InitiateFileDownload || set.ListContainer || set.GetPath {
b.WriteString("r")
}
if set.InitiateFileUpload || set.Move {
Expand Down
31 changes: 31 additions & 0 deletions pkg/storage/utils/ace/ace_suite_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2018-2021 CERN
//
// Licensed under the Apache License, Version 2.0 (the "License");
// 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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// In applying this license, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package ace_test

import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

func TestAce(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Ace Suite")
}
Loading

0 comments on commit 881b15e

Please sign in to comment.