Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grpc integration tests for the ocis and the owncloud storage drivers #1514

Merged
merged 24 commits into from
Mar 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d29febf
Port grpc tests to ginkgo, increase test coverage
aduffeck Feb 18, 2021
a321809
Also consider the opaque id when searching for users
aduffeck Feb 18, 2021
c90864b
Add grpc integration tests for the storage provider
aduffeck Feb 19, 2021
9454cb8
Add grpc tests for GetPath and CreateContainer
aduffeck Feb 22, 2021
26c175b
Add testsuite for the ace package
aduffeck Feb 22, 2021
44a8483
Make the GetPath permission translate to a "r" ace permission
aduffeck Feb 22, 2021
fadf79d
Fix setting the user and group ids in the grants created from an ace
aduffeck Feb 22, 2021
9cf6016
Assert grpc integration tests for Delete and *Grant(s)
aduffeck Feb 22, 2021
af32650
Add unit test for grants
aduffeck Feb 22, 2021
807bfc4
Add more grpc integration tests
aduffeck Feb 22, 2021
fd406fc
Paths always start with a /, also in RecycleItems
aduffeck Feb 23, 2021
c2edcee
Allow for starting multiple revads for grpc integration tests
aduffeck Feb 23, 2021
3b3aac8
Add grpc integration tests for purging a recycle item
aduffeck Feb 24, 2021
89c0618
Add grpc integration test for UpdateGrant
aduffeck Feb 24, 2021
c6956b1
Add grpc integration test for Move
aduffeck Feb 24, 2021
6656a01
Add grpc integration test for file versions
aduffeck Feb 24, 2021
d5cca97
Add grpc integration tests for arbitrary metadata
aduffeck Feb 24, 2021
bb1467b
Add grpc tests for the owncloud driver
aduffeck Feb 25, 2021
a300361
Return CODE_NOT_FOUND when listing the non-existent shared folder
aduffeck Feb 25, 2021
2c129ee
Fix hound issues
aduffeck Mar 4, 2021
f09b63f
Fix license headers
aduffeck Mar 5, 2021
72e19b9
Move the grpc integration tests to a separate pipeline
aduffeck Mar 5, 2021
a1ef1cf
Fix linter issues
aduffeck Mar 5, 2021
21c536e
Add changelog
aduffeck Mar 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def main(ctx):
return [
buildAndPublishDocker(),
buildOnly(),
testIntegration(),
release(),
litmusOcisOldWebdav(),
litmusOcisNewWebdav(),
Expand Down Expand Up @@ -256,6 +257,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 @@ -37,7 +37,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 ./...

lint:
go run tools/check-license/check-license.go
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