我通过添加2个容器并按时序数据划分测试来添加并行性。到目前为止,构建还不错。但是,我现在收到特定Rails系统测试的“权限被拒绝”错误。我正在运行Rails 5.2应用程序并使用minitest。这是我的circleci配置:
version: 2
jobs:
build:
working_directory: ~/my_app
parallelism: 2
docker:
- image: circleci/ruby:2.5-node-browsers
environment:
RAILS_ENV: test
BUNDLE_JOBS: 3
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
PGHOST: 127.0.0.1
PGUSER: test_user
- image: circleci/postgres:10.4-alpine
environment:
POSTGRES_USER: test_user
POSTGRES_DB: my_app_test
POSTGRES_PASSWORD: ""
- image: circleci/redis:4
- image: circleci/node:jessie-browsers
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install mcrypt library
command: sudo apt-get install libmcrypt-dev
- run:
name: Bundle Install
command: bundle check || bundle install
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
- run:
name: Copy secret files
command: |
cp config/database.yml.ci config/database.yml
# Database setup
# Waits until DB service is available, according to CircleCI docs:
# https://circleci.com/docs/2.0/language-ruby/#config-walkthrough
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Database Setup
command: |
bundle exec rake db:create
bundle exec rake db:schema:load
- run:
name: Create directy to store test results
command: mkdir test/reports
- run:
name: Download Selenium
command: curl -O http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar
- run:
name: Start Selenium
command: java -jar selenium-server-standalone-3.5.3.jar -log test-reports/selenium.log
background: true
# https://circleci.com/docs/2.0/parallelism-faster-jobs/#splitting-by-timings-data
- run:
name: Run Tests
command: |
bundle exec rake test
bundle exec rake test:system TESTOPTS='--verbose'
$(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)
# https://circleci.com/docs/2.0/collect-test-data/#minitest
- store_test_results:
path: test/reports
我得到的错误是:
101 runs, 565 assertions, 0 failures, 0 errors, 2 skips
/bin/bash: line 2: test/system/dashboard_test.rb: Permission denied
Exited with code 126
不配置并行性和设置测试输出结果时,没有任何权限问题。我遵循了CircleCI文档的指示:
我在做什么错了?