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 unit tests coverage #1983

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def main(ctx):
# ocisIntegrationTests(6, [1, 4]) - this will only run 1st and 4th parts
# implemented for: ocisIntegrationTests and s3ngIntegrationTests
return [
coverage(),
buildAndPublishDocker(),
buildOnly(),
testIntegration(),
Expand Down Expand Up @@ -228,6 +229,46 @@ def buildAndPublishDocker():
]
}

def coverage():
return {
"kind": "pipeline",
"type": "docker",
"name": "unit-test-coverage",
"platform": {
"os": "linux",
"arch": "amd64",
},
"trigger":{
"branch":[
"master"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ishank011 master should now also run the coverage report

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change event to push?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want you also can edit it directly. I must confess that I am not really familiar with the include / exclude logic of Drone since we are using the reference format for achieving the same "trigger": { "ref": [ "refs/heads/master", "refs/pull/**", ], },

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need push because PR and master should be the only cases!?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"trigger": { "ref": [ "refs/heads/master", "refs/pull/**", ], }, is working fine in all owncloud repos

],
"event": {
"include": [
"pull_request",
],
},
},
"steps": [
{
"name": "unit-test",
"image": "registry.cern.ch/docker.io/library/golang:1.16",
"commands": [
"make test",
],
},
{
"name": "codacy",
"image": "plugins/codacy:1",
"pull": "always",
"settings": {
"token": {
"from_secret": "codacy_token",
},
},
},
]
}

def buildOnly():
return {
"kind": "pipeline",
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ vendor-bin/**/composer.lock
tests/acceptance/output
tmp/

# drone
.drone.yml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ build-reva: imports
go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva

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

test-integration: build-ci
cd tests/integration && go test -race ./...
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/codacy-coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add Codacy unit test coverage

This PR adds unit test coverage upload to Codacy.

https://github.com/cs3org/reva/pull/1983