0
使用分子v.2來測試Ansible角色,我面臨一個問題,即角色的檢查是冪等的。如何禁用Ansible角色測試中的分子冪等檢查?
如何禁用此檢查?
作爲documented,需要在molecule.yml
文件中設置分子配置參數,但我找不到如何禁用冪等性檢查。
---
# molecule.yml file
dependency:
name: galaxy
driver:
name: docker
lint:
name: ansible-lint
options:
x: ANSIBLE0006,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013
platforms:
- name: mongo01
image: mongo:3.2
privileged: yes
groups:
- mongodb
- mongodb_master
- name: mysql_server
image: mysql
environment:
MYSQL_ROOT_PASSWORD: some_password
groups:
- mysql
- name: elasticsearch
image: molecule_local/centos:6
command: sleep infinity
dockerfile: Dockerfile
privileged: yes
groups:
- elastic
- name: esb
image: molecule_local/centos:6
command: sleep infinity
dockerfile: Dockerfile
links:
- "elasticsearch-default:elasticsearch elasticsearch01"
- "mongo01-default:mongo mongo_b2b mongo01"
- "mysql_server-default:mysql mysql_server"
groups:
- fabric
provisioner:
name: ansible
config_options:
defaults:
vault_password_file: /path/to/vault/file
diff: yes
scenario:
name: default
# Probably something like below should disable idempotency check.
idempotent: false
# Uncomment when developing locally to
# keep instances running when tests are completed.
# Must be kept commented when building on CI/CD.
# test_sequence:
# - destroy
# - create
# - converge
# - lint
# - verify
verifier:
name: testinfra
我想完全擺脫冪等檢查,並依靠我自己的測試。
再次謝謝techraf。要去試試看。 我無法猜測它是冪等(不是冪等或...),應該在test_sequence下設置,而不是可信配置的一部分。 即使使用網站本身的搜索服務,它絕對不在文檔中。 –
https://github.com/metacloud/molecule/commit/49481498a25ad65ecac5267fb29885b84faf6b2d – techraf
不錯。應該已經檢查了代碼。 –