diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8c6a4294..51cf62833 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,7 +102,7 @@ jobs: ########################################################################## - name: mariadb | Build `test` image run: | - docker build -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./ + docker build --target mariadb_server_test -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./ docker save "gradido/mariadb:test" > /tmp/mariadb.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -222,6 +222,21 @@ jobs: name: Unit tests - Login-Server runs-on: ubuntu-latest needs: [build_test_login_server] + services: + mariadb: + build: + context: . + dockerfile: ./mariadb/Dockerfile + target: mariadb_server_test + environment: + - MARIADB_ALLOW_EMPTY_PASSWORD=1 + - MARIADB_USER=root + networks: + - internal-net + ports: + - 3306:3306 + volumes: + - db_vol:/var/lib/mysql steps: ########################################################################## # CHECKOUT CODE ########################################################## @@ -243,11 +258,7 @@ jobs: ########################################################################## - name: Login-Server | Unit tests run: | - docker run \ - -v ~/coverage:/code/build/coverage_html \ - -v ./configs/login_server:/code/build \ - --rm gradido/login_server:test \ - "make -C /code/build -j$(nproc) coverage_html" + 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 cp -r ~/coverage ./coverage #test: diff --git a/mariadb/Dockerfile b/mariadb/Dockerfile index e941cac66..614597a37 100644 --- a/mariadb/Dockerfile +++ b/mariadb/Dockerfile @@ -32,8 +32,4 @@ COPY ./mariadb/setup_test_dbs.sql a2_setup_dbs.sql # login server test db COPY ./login_server/skeema/ . RUN cd ./gradido_login/ && for f in *.sql; do cp -- "$f" "../b_$f"; sed -i '1i use gradido_login_test;' "../b_$f"; done -RUN cd ./gradido_login/insert && for f in *.sql; do cp -- "$f" "../../c_$f"; sed -i '1i use gradido_login_test;' "../../c_$f"; done -# community server test db -COPY ./community_server/skeema/ . -RUN cd ./gradido_community/ && for f in *.sql; do cp -- "$f" "../d_$f"; sed -i '1i use gradido_community_test;' "../d_$f"; done -RUN cd ./gradido_community/insert && for f in *.sql; do cp -- "$f" "../../e_$f"; sed -i '1i use gradido_community_test;' "../../e_$f"; done + diff --git a/mariadb/setup_test_dbs.sql b/mariadb/setup_test_dbs.sql new file mode 100644 index 000000000..10326d002 --- /dev/null +++ b/mariadb/setup_test_dbs.sql @@ -0,0 +1,10 @@ +create database gradido_login_test + DEFAULT CHARACTER SET utf8mb4 + DEFAULT COLLATE utf8mb4_unicode_ci; +create database gradido_community_test + DEFAULT CHARACTER SET utf8mb4 + DEFAULT COLLATE utf8mb4_unicode_ci; +create database IF NOT EXISTS _skeema_tmp + DEFAULT CHARACTER SET utf8mb4 + DEFAULT COLLATE utf8mb4_unicode_ci; +FLUSH PRIVILEGES; \ No newline at end of file