未在AWS Codebuild中工作的测试范围

发布于 2025-02-08 20:40:59 字数 1037 浏览 1 评论 0原文

我有使用TestContainers运行测试的Spring Boot应用程序。所有测试都在本地运行,但是当我尝试在AWS CodeBuild项目中尝试时,它会失败。看起来它无法连接到数据库。 这是我的buildspec.yml文件。

version: 0.2
phases:
  install:
    runtime-versions:
      nodejs: 12
      java: corretto11
  pre_build:
    commands:
      - export ROOT_DIR=$PWD
  build:
    commands:
      - echo Starting build at `date`
      - cd $ROOT_DIR && ./gradlew integrationTest

运行时,我会遇到以下错误。/gradlewIntegrationTest

UserServiceIT > assertThatResetKeyMustBeValid() FAILED
    java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
        Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1786
            Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException at HikariPool.java:595
                Caused by: java.lang.IllegalStateException at Preconditions.java:174

在每个测试中都高于异常。我尝试过 testContainers_ryuk_disabled = true ,但仍然无法正常工作。

I have spring boot application which uses testcontainers to run tests. All the tests are running locally but when I tried in AWS Codebuild project, it is failing. Looks like it is unable to connect to database.
This is my buildspec.yml file for codebuild.

version: 0.2
phases:
  install:
    runtime-versions:
      nodejs: 12
      java: corretto11
  pre_build:
    commands:
      - export ROOT_DIR=$PWD
  build:
    commands:
      - echo Starting build at `date`
      - cd $ROOT_DIR && ./gradlew integrationTest

I am getting following error when running ./gradlew integrationTest

UserServiceIT > assertThatResetKeyMustBeValid() FAILED
    java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:132
        Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1786
            Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException at HikariPool.java:595
                Caused by: java.lang.IllegalStateException at Preconditions.java:174

Getting above exception for every test. I have tried TESTCONTAINERS_RYUK_DISABLED=true but still not working.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文