【问题标题】:Bitbucket pipelines are failing on insuficient memmory, while testing with cassandra in docker (Scala)Bitbucket 管道因内存不足而失败,同时在 docker (Scala) 中使用 cassandra 进行测试
【发布时间】:2021-07-26 23:02:56
【问题描述】:

我有需要 docker cassandra 启动并运行的 Scala 测试。

我会根据配置获得其中之一

  • Container 'Build' exceeded memory limit.
  • Container 'docker' exceeded memory limit.
  • Cassandra 容器 OOM

【问题讨论】:

    标签: docker cassandra bitbucket testcontainers


    【解决方案1】:

    最后是 cassandra 配置获胜,但还有一组 bitbucket 配置:

    • cassandra env 变量,为测试容器设置,但可以以任何其他方式传递给 docker
     val container: CassandraContainer = CassandraContainer()
     container.container.addEnv("JVM_OPTS", "-Xms1024M -Xmx1024M")
     container.container.addEnv("HEAP_NEWSIZE", "128M")
     container.container.addEnv("MAX_HEAP_SIZE", "2048M")
     container.start()
    
    • bitbucket 管道
    options:
      docker: true
      size: 2x # Increase max size to 8GB
    
    definitions:
      services:
        docker:
          memory: 4096 # Give 4 to docker
    
    ...
    
      - step:
              name: run the tests
              caches:
                - sbt
                - ivy2
              script:
                - export TESTCONTAINERS_RYUK_DISABLED=true
                # Limit sbt memory usage
                - export SBT_OPTS="-Xms1024m -Xmx1024m -XX:+CMSClassUnloadingEnabled -Xss4m -XX:+UseConcMarkSweepGC"
                - sbt -v scalafmtSbtCheck scalafmtCheck +compile +test
              services:
                - docker
    
    

    【讨论】:

      猜你喜欢
      • 2014-01-06
      • 1970-01-01
      • 2017-09-30
      • 2018-08-29
      • 1970-01-01
      • 2021-08-15
      • 2019-07-06
      • 1970-01-01
      • 2018-12-19
      相关资源
      最近更新 更多