현재 빌드, 테스트, 패키지 및 응용 프로그램의 배포를 자동화하기 위해 .gitlab-ci.yml 파일을 작성하고 있지만 빌드 작업은 통과하지만 다른 작업 (테스트, 배포)에 실패했습니다.Gitlab-CI : 테스트 작업이 실패했습니다
내 응용 프로그램은 데이터를 저장하는 MySQL 데이터베이스가있는 Springboot 웹 응용 프로그램이며 프로젝트를 빌드하는 데 maven을 사용하고 있습니다.
2017-12-23 10:00:33.854 WARN 65 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : maxIdle is larger than maxActive, setting maxIdle to: 50
2017-12-23 10:00:34.567 ERROR 65 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago.
The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
당신은 문제가 무엇인지 시겠어요 : 아래
내가 받고있어 오류는 다음과 같은 내 .gitlab-ci.yml 파일
before_script:
- echo "Execute scripts which are required to bootstrap the application. !"
after_script:
- echo "Clean up activity can be done here !."
stages:
- build
- test
- package
- deploy
variables:
MAVEN_CLI_OPTS: "--batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
cache:
paths:
- .m2/repository/
- target/
build:
stage: build
image: maven:latest
script:
- mvn $MAVEN_CLI_OPTS clean compile
test:
stage: test
image: maven:latest
script:
- mvn $MAVEN_CLI_OPTS test
package:
stage: package
image: maven:latest
script:
- mvn $MAVEN_CLI_OPTS package
artifacts:
paths: [target/basecamp-0.0.1.war]
deploy_test:
stage: deploy
script:
- echo "######## To be defined ########"
environment: staging
deploy_prod:
stage: deploy
script:
- echo "######## To be defined ########"
only:
- master
environment: production
입니까?
감사합니다, G.
할 수있는 로컬로 실행'MVN test' 아마 문제를 함께있다. Spring 문맥 전체를로드하려고 시도하는 SpringBoot의 자동 생성 테스트와 그 때문에 앱이 데이터베이스에 연결하려고합니다. CI 환경에 데이터베이스가 없기 때문에 테스트가 실패합니다. – rieckpil
@rieckpil 예, 로컬로 모든 것이 정상적으로 실행 중입니다. 테스트는 로컬에서 잘 실행됩니다. 문제는 자동 생성 된 테스트가 아닙니다. 내가 구현 한 단위 테스트가 잔뜩 있습니다. 그들 모두는 현지에서 잘 운영되고 있습니다. – yimson
로컬 mysql을 중지하고 테스트를 다시 실행하십시오. – rieckpil