Debian Codegraph @

ansible_collections/community/clickhouse/tests/integration/targets/clickhouse_cfg_info/tasks/initial.yml

raw
1 ####################################################################
2 # WARNING: These are designed specifically for Ansible tests #
3 # and should not be used as examples of how to write Ansible roles #
4 ####################################################################
5
6 - name: Put config.yaml file in place
7 ansible.builtin.copy:
8 src: config.yaml
9 dest: /tmp/config.yaml
10
11 - name: Put config.xml file in place
12 ansible.builtin.copy:
13 src: config.xml
14 dest: /tmp/config.xml
15
16 - name: Retrieve info from config.yaml
17 register: result
18 community.clickhouse.clickhouse_cfg_info:
19 path: /tmp/config.yaml
20
21 - name: Check the content
22 ansible.builtin.assert:
23 that:
24 - result['config']['http_port'] == 8123
25 - result['config']['tcp_port'] == 9000
26 - result['config']['error_log']['collect_interval_milliseconds'] == 1000
27 - result['config']['graphite_rollup_example']['default']['retention'][0]['age'] == 0
28 - result['config']['crash_log']['partition_by'] == ''
29 - result['config']['grpc']['enable_ssl'] == false
30
31 - name: Retrieve info from config.xml
32 register: result
33 community.clickhouse.clickhouse_cfg_info:
34 path: /tmp/config.xml
35
36 - name: Check the content
37 ansible.builtin.assert:
38 that:
39 - result['config']['http_port'] == 8123
40 - result['config']['tcp_port'] == 9000
41 - result['config']['error_log']['collect_interval_milliseconds'] == 1000
42 - result['config']['graphite_rollup_example']['default']['retention'][0]['age'] == 0
43 - result['config']['crash_log']['partition_by'] == none
44 - result['config']['grpc']['enable_ssl'] == false
45
46 - name: Try to retreive info from a non-existing file
47 register: result
48 ignore_errors: true
49 community.clickhouse.clickhouse_cfg_info:
50 path: /tmp/non-existing.yaml
51
52 - name: Assert failure
53 ansible.builtin.assert:
54 that:
55 - result is failed
56 - result.msg is search('Could not open/load from file')
57
58
59 - name: Prepare YAML config with recursive alias (invalid)
60 ansible.builtin.copy:
61 dest: /tmp/cfg_recursive.yaml
62 content: |
63 a: &a
64 b: *a
65
66 - name: Try to retrieve YAML config with recursive alias
67 register: recursive_yaml_result
68 community.clickhouse.clickhouse_cfg_info:
69 path: /tmp/cfg_recursive.yaml
70 ignore_errors: true
71
72 - name: Assert recursive alias in YAML fails
73 ansible.builtin.assert:
74 that:
75 - recursive_yaml_result.failed
76 - recursive_yaml_result.msg is search('Could not open/load from file')
77 - recursive_yaml_result.msg is search('Circular reference detected')