add code for community server coverage

This commit is contained in:
einhorn_b 2021-05-21 20:15:26 +02:00
parent 713b7b3dcc
commit f8bb7cc08d
4 changed files with 21 additions and 9 deletions

View File

@ -316,9 +316,19 @@ jobs:
##########################################################################
- name: Login-Server | Unit tests
run: |
docker run -v ~/coverage:/code/build/coverage -v ./configs/login_server/Gradido_LoginServer_Test.properties:/code/build/Gradido_LoginServer_Test.properties gradido/login_server:test --entrypoint
docker run -v ~/coverage:/code/build/coverage -v gradido/login_server:test " ./vendor/bin/phpunit --coverage-html ./coverage"
cp -r ~/coverage ./coverage
##########################################################################
# COVERAGE CHECK BACKEND COMMUNITY-SERVER ####################################
##########################################################################
- name: backend | Coverage check
uses: webcraftmedia/coverage-check-action@master
with:
report_name: Coverage Backend
type: lcov
result_path: ./coverage/lcov.info
min_coverage: 8
token: ${{ github.token }}
#test:
# runs-on: ubuntu-latest

View File

@ -23,8 +23,7 @@ class CommunityProfilesFixture extends TestFixture
'state_user_id' => ['type' => 'index', 'columns' => ['state_user_id'], 'length' => []],
],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
'community_profiles_ibfk_1' => ['type' => 'foreign', 'columns' => ['state_user_id'], 'references' => ['state_users', 'id'], 'update' => 'restrict', 'delete' => 'restrict', 'length' => []],
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []]
],
'_options' => [
'engine' => 'InnoDB',

View File

@ -306,9 +306,9 @@ return [
'persistent' => false,
'host' => 'localhost',
//'port' => 'non_standard_port_number',
'username' => 'my_app',
'password' => 'secret',
'database' => 'test_myapp',
'username' => 'root',
'password' => '',
'database' => 'gradido_community_test',
//'encoding' => 'utf8mb4',
'timezone' => 'UTC',
'cacheMetadata' => true,

View File

@ -48,16 +48,19 @@ int load() {
printf("[load] error loading Gradido_LoginServer_Test.properties, make sure this file exist! (%s)\n", ex.displayText().data());
return -3;
}
std::clog << "[Gradido_LoginServer_Test::load] after loading config" << std::endl;
if (!ServerConfig::initServerCrypto(*test_config)) {
//printf("[Gradido_LoginServer::%s] error init server crypto\n", __FUNCTION__);
printf("[load] error init server crypto");
return -1;
}
std::clog << "[Gradido_LoginServer_Test::load] after init server crypto" << std::endl;
if (!ServerConfig::loadMnemonicWordLists()) {
printf("[load] error in loadMnemonicWordLists");
return -2;
}
std::clog << "[Gradido_LoginServer_Test::load] after load mnemonic word lists" << std::endl;
// start cpu scheduler
uint8_t worker_count = Poco::Environment::processorCount();
@ -77,6 +80,7 @@ int load() {
} catch(Poco::Exception& ex) {
printf("Poco Exception by connecting to db: %s\n", ex.displayText().data());
}
std::clog << "[Gradido_LoginServer_Test::load] after connecting to db" << std::endl;
//printf("try connect php server mysql \n");
//conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_PHP_SERVER);
@ -132,8 +136,7 @@ int load() {
int run()
{
//printf("running tests\n");
printf("running tests\n");
std::clog << "[Gradido_LoginServer_Test::run]" << std::endl;
for (std::list<Test*>::iterator it = gTests.begin(); it != gTests.end(); it++)
{
//printf("running: %s\n", it->getName());