我需要在 gitlab 管道上运行单元测试。这是我的.gitlab-ci.yml
:
stages:
- build
image: napp/php-ci:7.4-fpm
services:
- name: mysql:5.7
alias: mysql
variables:
MYSQL_ROOT_PASSWORD: pass_root
MYSQL_DATABASE: db_test
MYSQL_USER: user
MYSQL_PASSWORD: test
DATABASE_URL: 'mysql://user:test@mysql:3306/db_test'
build:
stage: build
only:
- master
- staging
services:
- mysql:5.7
script:
- apt-get update
- apt-get install zip unzip
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- php -r "unlink('composer-setup.php');"
- php composer.phar install
- php bin/console app:deploy:symfony:local
- ./vendor/bin/phpunit
在 gitlab 上我有错误:Access denied for user 'user'@'%' to database 'db_test_test'
为什么它不在db_test
'db_test_test' 上进行测试?
你能帮我吗,这样我就可以运行它适当的数据库-db_test