Execution failed for task ':compileJava'.에러 해결을 하고 다시 ./gradlew test를 실행했더니
이 오류는 해결되고
다른 오류가 발생했다.
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///home/ec2-user/app/step1/springboot-webservice/build/reports/tests/test/index.html
테스트 폴더에 있던 테스트함수들이 실패한 상황이었다.
원인
원인을 찾아보니 로컬에서 테스트할 때는 인텔리제이가 test폴더에 application.properties이 없다면 main폴더에 있는 application.properties를 가져와서 사용했기 때문에, test 폴더에 따로 추가하지 않았다.
putty에서 EC2를 접속해서 할 때는 인텔리제이 환경이 아니기 때문에 test 폴더에 없다고 main 폴더를 확인하지 않는다.
그래서 발생한 오류였다.
해결방법
1. test -> resources 폴더에 application.properties를 생성 후 깃허브에 파일을 push한다.
application.properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect
spring.jpa.properties.hibernate.dialect.storage_engine=innodb
spring.datasource.hikari.jdbc-url=jdbc:h2:mem:testdb;MODE=MYSQL
spring.datasource.hikari.username=sa
spring.security.oauth2.client.registration.google.client-id=test
spring.security.oauth2.client.registration.google.client-secret=test
spring.security.oauth2.client.registration.google.scope=profile,email
2. EC2에 접속해서 git pull하고 ./gradlew test한다.
그러면 테스트가 통과된다!!!
댓글