Pipeline test stage fails, even tho locally all integration tests pass
this is my test stage
Running with gitlab-runner 13.5.0-rc2 (71c90c86)
on docker-auto-scale z3WU8uu-
Resolving secrets
00:00
Preparing the "docker+machine" executor
00:34
Using Docker executor with image gradle:jdk11 ...
Pulling docker image gradle:jdk11 ...
Using docker image sha256:30857058f40c9f080598c452a49ebb79eb967cbebc20ef1fca37b049a4c0b81c for gradle:jdk11 with digest gradle@sha256:33f85a6c2d3fd5f81987f66db3a3e379e562587e20b5ae404d8c4f7f62f37fb3 ...
Preparing environment
00:02
Running on runner-z3wu8uu--project-21798357-concurrent-0 via runner-z3wu8uu--srm-1604300953-a90fc20e...
Getting source from Git repository
00:01
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/ilkin0/todo-simple/.git/
Created fresh repository.
Checking out 332cae04 as master...
Skipping Git submodules setup
Restoring cache
00:01
Checking cache for master...
Downloading cache.zip from https://storage.googleapis.com/gitlab-com-runners-cache/project/21798357/master
Successfully extracted cache
Executing "step_script" stage of the job script
01:38
$ export GRADLE_USER_HOME='pwd'/.gradle
$ chmod +x ./gradlew
$ ./gradlew check
./gradlew: 39: cd: can't cd to "./
Downloading https://services.gradle.org/distributions/gradle-6.6.1-bin.zip
.........10%..........20%..........30%..........40%.........50%..........60%..........70%..........80%..........90%.........100%
Welcome to Gradle 6.6.1!
Here are the highlights of this release:
- Experimental build configuration caching
- Built-in conventions for handling credentials
- Java compilation supports --release flag
For more details see https://docs.gradle.org/6.6.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :compileJava
> Task :processResources
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
com.ilkin.simpletodo.controller.TodoControllerTests > GET /api/todos/ FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at BeanDefinitionValueResolver.java:342
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1794
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100
com.ilkin.simpletodo.controller.TodoControllerTests > GET /api/todos//itemId FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at BeanDefinitionValueResolver.java:342
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1794
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100
com.ilkin.simpletodo.controller.TodoControllerTests > GET /api/todos/9223372036854775807 FAILED
java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
Caused by: org.springframework.beans.factory.BeanCreationException at BeanDefinitionValueResolver.java:342
Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1794
Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:275
Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:100
11 tests completed, 3 failed
> Task :test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> There were failing tests. See the report at: file:///builds/ilkin0/todo-simple/build/reports/tests/test/index.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 36s
4 actionable tasks: 4 executed
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
lst 3 integration tests failing. However on locally everything is okay.
this is my .gitlab-ci.yml. i think my gitlab.ci file might be problematic
image: gradle:jdk11
stages:
- build
- tests
before_script:
- export GRADLE_USER_HOME='pwd'/.gradle
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .gradle/wrapper
- .gradle/caches
package:
stage: build
script:
- chmod +x ./gradlew
- ./gradlew assemble
test:
stage: tests
script:
- chmod +x ./gradlew
- ./gradlew check
Edited by Ilkin Mehdiyev