
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
https://travis-ci.org/ONSdigital/rasrm-acceptance-tests.svg?branch=master](https://travis-ci.org/ONSdigital/rasrm-acceptance-tests)
System / API tests for RAS & RM services
To override any environment variables you should export any variables before running the tests with behave e.g. export HEADLESS=False or by creating a local .env file. Most of the environment variables are defined in config.py
bashpipenv install --dev make test
bashexport HEADLESS=False # or =True for Chrome in headless mode pipenv install --dev make test
bashmake start_services # Brings all the services up using Docker make setup # Prepares data for acceptance tests make style_tests # Will check for Flake8 errors make system_tests # Will run the system tests make acceptance_tests # Will run all acceptance make acceptance_sequential_tests # Will run the acceptance tests not yet converted to run in parallel make acceptance_parallel_tests # Will run the acceptance tests converted to run in parallel make acceptance_sequential_tests_all # Will run ALL the acceptance tests, sequentially, in case of race condition or load/contention failures with parallel tests make stop_services # Bring down all the Docker services make test # Will bring all the services up and run all the tests make TEST_TARGET=acceptance_tests/features/your.feature run_tests # Runs a single feature file WITHOUT 'make setup' first make TEST_TARGET=acceptance_tests/features/your.feature acceptance_tests # Runs a single feature file WITH 'make setup' first MAKE_TARGET: secure_messaging_acceptance_tests # Runs secure messaging tests
Config is set by environment variables in config.py
If any config is updated it also has to be updated in the Jenkinsfile
Its possible to use firefox as your browser instead of chrome. Do the following to do this:
brew install geckodriverexport WEBDRIVER=firefoxrun.py and wait to hit the breakpointSet Cloudfoundry database environment variables
bashexport CLOUDFOUNDRY_API= export CLOUDFOUNDRY_EMAIL= export CLOUDFOUNDRY_PASSWORD= export CLOUDFOUNDRY_ORG= export CLOUDFOUNDRY_SPACE=
Get database environment variables curl -fsSL https://raw.githubusercontent.com/ONSdigital/ras-deploy/master/scripts/get_database_uris.sh |bash|sed -e 's/@.*:5432/@localhost:5432/g' > setenvs.sh
Get database URI export DATABASE_NAME=$(cf apps | grep ras-collection-instrument-ci | awk '{ print "cf env "$1 }' | bash | grep "postgres://" | awk -F \" '{ print $4 }' | sed 's!postgres://.*@\(.*\):.*!\1!')
Create an SSH tunnel to the database cf ssh -L 5432:$DATABASE_NAME:5432 ras-collection-instrument-ci
cloudfoundry app name of a service that has a dependency on the database.
Set environment variables in shell fly -t ons get-pipeline -p rasrm|sed '1,/task: rasrm\-acceptance\-tests/d;/on_failure/,$d'|sed -e '1,3d; s/\"//g'|sed -e 's/\:\ /=/g'|awk '{print "export "$1 }' >> setenvs.sh
Set database environment variables source setenvs.sh
Reset data in cloudfoundry make setup
Run tests pipenv run python run.py
Note. To run in pycharm you'll need to put the same environment variables in
cat setenvs.sh|awk '{ print $2 }'|pbcopyrun.py by clicking Edit Configuration...Failing tests
Setup data
The tests may be failing because you have teared down postgres recently
make setup which will reload any data required for the testsStale images
If you've got an old image hanging around it could cause failures. There are two things to try
make pull within tmp_ras_rm_docker_dev and then re-run make testdocker kill $(docker ps -qa) ; docker rm $(docker ps -qa) ; docker rmi $(docker images -qa) to delete all images and then re-run make testFailing setup
Resetting databases bug
When running the acceptance tests, it may get stuck on resetting databases. This happens because a process gets into a deadlock and after a few minutes the make command should terminate. There is a way of terminating
the process before it hits a timeout and quits.
If you run the sql statement below, it should terminate the process in the deadlock and carry on running the acceptance tests. If it stops running
the make acceptance_tests command, just run the make command again and it should work.
sqlSELECT pg_terminate_backend(pid) FROM pg_stat_activity where state = 'idle in transaction' AND query like '%actioncase%'
Another way of terminating the deadlock is by going into pgadmin and terminating it there
localhost:80 and log in using details specified in https://github.com/ONSdigital/ras-rm-docker-dev#pgadmin-4您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务