Skip to content

Commit

Permalink
Generate coverage for quick DB tests
Browse files Browse the repository at this point in the history
This adds the "QUICKDB" group which excludes some tests that abuse unit tests as integration tests as displayed in #1626

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
  • Loading branch information
LukasReschke committed Oct 5, 2016
1 parent 66ae438 commit a1f5364
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
18 changes: 14 additions & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ pipeline:
when:
matrix:
TESTS: integration-sharees-features
codecov:
nodb-codecov:
image: nextcloudci/php7.0:php7.0-2
commands:
- TEST_SELECTION=NODB ./autotest.sh sqlite
Expand All @@ -310,12 +310,22 @@ pipeline:
- sh -c "if [ '$DRONE_BUILD_EVENT' != 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
when:
matrix:
TESTS: codecov

TESTS: nodb-codecov
db-codecov:
image: nextcloudci/php7.0:php7.0-2
commands:
- TEST_SELECTION=QUICKDB ./autotest.sh sqlite
- wget https://codecov.io/bash -O codecov.sh
- sh -c "if [ '$DRONE_BUILD_EVENT' = 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -P $DRONE_PULL_REQUEST -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
- sh -c "if [ '$DRONE_BUILD_EVENT' != 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
when:
matrix:
TESTS: db-codecov
matrix:
include:
- TESTS: signed-off-check
- TESTS: codecov
- TESTS: nodb-codecov
- TESTS: db-codecov
- TESTS: integration-capabilities_features
- TESTS: integration-federation_features
- TESTS: integration-auth
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/tests/EtagPropagationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* Class EtagPropagationTest
*
* @group DB
* @group SLOWDB
*
* @package OCA\Files_Sharing\Tests
*/
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/tests/GroupEtagPropagationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use OC\Files\View;

/**
* @group DB
* @group SLOWDB
*
* @package OCA\Files_Sharing\Tests
*/
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/tests/SharedMountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Class SharedMountTest
*
* @group DB
* @group SLOWDB
*/
class SharedMountTest extends TestCase {

Expand Down
7 changes: 5 additions & 2 deletions autotest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,14 @@ function execute_tests {
export XDEBUG_CONFIG=$_XDEBUG_CONFIG
fi
GROUP=''
if [ "$TEST_SELECTION" == "QUICKDB" ]; then
GROUP='--group DB --exclude-group=SLOWDB'
fi
if [ "$TEST_SELECTION" == "DB" ]; then
GROUP='--group DB'
GROUP='--group DB,SLOWDB'
fi
if [ "$TEST_SELECTION" == "NODB" ]; then
GROUP='--exclude-group DB'
GROUP='--exclude-group DB,SLOWDB'
fi

COVER=''
Expand Down
6 changes: 4 additions & 2 deletions tests/lib/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,10 @@ private function IsDatabaseAccessAllowed() {
return true;
}
$annotations = $this->getAnnotations();
if (isset($annotations['class']['group']) && in_array('DB', $annotations['class']['group'])) {
return true;
if (isset($annotations['class']['group'])) {
if(in_array('DB', $annotations['class']['group']) || in_array('SLOWDB', $annotations['class']['group']) ) {
return true;
}
}

return false;
Expand Down

0 comments on commit a1f5364

Please sign in to comment.