changes this time also for community server

This commit is contained in:
einhorn_b 2021-05-25 10:21:23 +02:00
parent 15bff50291
commit ff0c418c60
7 changed files with 49 additions and 17 deletions

View File

@ -88,7 +88,7 @@ jobs:
##########################################################################
- name: community server | Unit tests
run: |
docker run -v ~/coverage:/var/www/cakephp/webroot/coverage gradido/community_server:test "./vendor/bin/phpunit --coverage-html ./webroot/coverage"
docker run -v ~/coverage:/var/www/cakephp/webroot/coverage gradido/community_server:test ./vendor/bin/phpunit --coverage-html ./webroot/coverage
cp -r ~/coverage ./coverage
##########################################################################
# COVERAGE CHECK BACKEND COMMUNITY-SERVER ####################################

View File

@ -305,7 +305,7 @@ jobs:
##########################################################################
- name: community server | Unit tests
run: |
docker run -v ~/coverage:/var/www/cakephp/webroot/coverage gradido/community_server:test "./vendor/bin/phpunit --coverage-html ./webroot/coverage"
docker run -v ~/coverage:/var/www/cakephp/webroot/coverage gradido/community_server:test ./vendor/bin/phpunit --coverage-html ./webroot/coverage
cp -r ~/coverage ./coverage
##########################################################################
# COVERAGE CHECK BACKEND COMMUNITY-SERVER ####################################

View File

@ -1,8 +1,8 @@
FROM phpdockerio/php74-fpm
FROM phpdockerio/php74-fpm as community_server
# install php fpm
RUN apt-get update \
&& apt-get -y --no-install-recommends install curl unzip php7.4-curl php7.4-fpm php7.4-mbstring php7.4-intl php7.4-xml php7.4-pdo php7.4-mysql \
&& apt-get -y --no-install-recommends install curl unzip php7.4-curl php7.4-fpm php7.4-mbstring php7.4-intl php7.4-xml php7.4-pdo php7.4-mysql php7.4-xdebug \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
WORKDIR /var/www/cakephp
@ -14,4 +14,14 @@ RUN composer update
RUN composer dump-autoload
######### special for code coverage and testing
FROM community_server as test
RUN apt-get update \
&& apt-get -y --no-install-recommends install php7.4-xdebug \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
WORKDIR /var/www/cakephp
ENV XDEBUG_MODE=coverage

View File

@ -304,7 +304,7 @@ return [
'className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'host' => 'localhost',
'host' => 'mariadb',
//'port' => 'non_standard_port_number',
'username' => 'root',
'password' => '',

View File

@ -47,6 +47,7 @@ services:
community-server:
build:
context: .
target: community_server
dockerfile: ./community_server/Dockerfile
environment:
- DB_PASSWORD=''

View File

@ -89,6 +89,7 @@ services:
community-server:
build:
context: .
target: community_server
dockerfile: ./community_server/Dockerfile
environment:
- DB_PASSWORD=''

View File

@ -82,11 +82,17 @@ int load(int argc, char* argv[]) {
auto conn = ConnectionManager::getInstance();
//conn->setConnection()
//printf("try connect login server mysql db\n");
bool connected = false;
try {
conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_LOGIN_SERVER);
if(conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_LOGIN_SERVER)) {
connected = true;
}
}
catch (Poco::Exception& ex) {
// maybe we in docker environment and db needs some time to start up
printf("Poco Exception by connecting to db: %s, let's try again\n", ex.displayText().data());
}
if(!connected) {
// let's wait 10 seconds
int count = 10;
while (count > 0) {
@ -94,15 +100,25 @@ int load(int argc, char* argv[]) {
count--;
Poco::Thread::sleep(1000);
}
conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_LOGIN_SERVER);
try {
if(conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_LOGIN_SERVER)) {
connected = true;
}
} catch(Poco::Exception& ex) {
printf("Poco Exception by connecting to db: %s, let's wait another 10 seconds\n", ex.displayText().data());
}
}
std::clog << "Wait another 10 seconds for mysql/mariadb" << std::endl;
Poco::Thread::sleep(10000);
try {
conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_LOGIN_SERVER);
} catch(Poco::Exception& ex) {
printf("Poco Exception by connecting to db: %s\n", ex.displayText().data());
}
if(!connected) {
Poco::Thread::sleep(10000);
try {
conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_LOGIN_SERVER);
} catch(Poco::Exception& ex) {
printf("Poco Exception by connecting to db: %s, exit\n", ex.displayText().data());
return -4;
}
}
//printf("try connect php server mysql \n");
//conn->setConnectionsFromConfig(*test_config, CONNECTION_MYSQL_PHP_SERVER);
@ -183,9 +199,13 @@ void ende()
int main(int argc, char** argv)
{
if (load(argc, argv) < 0) {
printf("early exit\n");
return -42;
try {
if (load(argc, argv) < 0) {
printf("early exit\n");
return -42;
}
} catch(std::exception& ex) {
printf("no catched exception while loading: %s\n", ex.what());
}
run();
ende();