【发布时间】:2018-02-17 10:54:47
【问题描述】:
伙计们,我在 circleci 上遇到超时错误。 测试用例在 localhost 上运行良好,但在 circleci 上出现以下错误。
command bundle exec rspec 自上次输出后耗时超过 10 分钟
我尝试了很多更改,但由于 TIMEOUT 错误,我的构建仍然失败。 我还尝试在 bundle exec rspec 命令中添加 --format progress。但仍然是同样的问题。
这是我所有文件的配置。
machine:
environment:
AWS_ACCESS_KEY_ID: key
AWS_SECRET_ACCESS_KEY: secret
AWS_REGION: us-east-1
TEST_CLUSTER_COMMAND: elasticsearch-1.5.2/bin/elasticsearch
TEST_CLUSTER_LOGS: /tmp
TEST_CLUSTER_NODES: 1
HOST: localhost:3000
QR_DOMAIN: test.bsqr1.com
ruby:
version: 2.3.1
hosts:
test.bsqr1.com: 127.0.0.1
dependencies:
bundler:
without: [development]
cache_directories:
- elasticsearch-1.5.2
post:
- if [[ ! -e elasticsearch-1.5.2 ]]; then wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.2.tar.gz && tar -xvf elasticsearch-1.5.2.tar.gz; fi
test:
override:
- bundle exec rspec:
parallel: true
Test.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Randomize the order test cases are executed.
config.active_support.test_order = :random
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = {host: 'localhost', port: 3000}
config.action_mailer.perform_deliveries = true
config.active_job.queue_adapter = :test
config.react.variant = :development
#sdm
config.assets.debug = true
config.assets.logger = Logger.new $stdout
config.assets.compress = true # Compress precompiled assets
config.assets.compile = false # Refuse to compile assets on-the-fly
config.assets.digest = true # Add a cache-busting extension to asset filenames
config.action_controller.asset_host = "file://#{::Rails.root}/public"
#sdm end
end
【问题讨论】:
-
嗨,我在 CI 设置(机器 -> 环境)中看不到 RAILS_ENV。你能设置
RAILS_ENV: test吗?或者您需要在其中运行它的其他环境。 -
嗨..!!我刚刚解决了这个问题。问题出在资产编译中。在测试环境中,一些样式表没有进行属性编译
标签: ruby-on-rails rspec capybara circleci