From f8bb7cc08d4b50fe0147848c0f3e0575b94b1928 Mon Sep 17 00:00:00 2001 From: einhorn_b Date: Fri, 21 May 2021 20:15:26 +0200 Subject: [PATCH] add code for community server coverage --- .github/workflows/test.yml | 14 ++++++++++++-- .../tests/Fixture/CommunityProfilesFixture.php | 3 +-- configs/community_server/app.php | 6 +++--- login_server/src/cpp/test/main.cpp | 7 +++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a78292f2f..3f722e7ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/community_server/tests/Fixture/CommunityProfilesFixture.php b/community_server/tests/Fixture/CommunityProfilesFixture.php index 1259d6e25..0fa7ed764 100644 --- a/community_server/tests/Fixture/CommunityProfilesFixture.php +++ b/community_server/tests/Fixture/CommunityProfilesFixture.php @@ -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', diff --git a/configs/community_server/app.php b/configs/community_server/app.php index f0cf46220..2dafaf554 100644 --- a/configs/community_server/app.php +++ b/configs/community_server/app.php @@ -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, diff --git a/login_server/src/cpp/test/main.cpp b/login_server/src/cpp/test/main.cpp index 656e9a090..609284d38 100644 --- a/login_server/src/cpp/test/main.cpp +++ b/login_server/src/cpp/test/main.cpp @@ -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::iterator it = gTests.begin(); it != gTests.end(); it++) { //printf("running: %s\n", it->getName());