2 # ansible-playbook -e PR=<PRID> -e new_plugin=<plugin> collectd6_test.yml
4 # As well as passing a PRID, a config command should be passable too since
5 # a lot of the plugins have been explicitly disabled in the build.
9 - name: Set names for containers to be used for testing
11 collectd5_container_name: "bar-collectd-latest"
12 collectd6_container_name: "bar-collectd-6{{ '-' + PR if PR is defined }}"
13 flask_container_name: "test-collectd-5-v-6"
15 - name: Remove existing containers
21 - "{{ collectd5_container_name }}"
22 - "{{ collectd6_container_name }}"
23 - "{{ flask_container_name }}"
25 - name: Get a list of containers
30 - name: Confirm that existing test containers were removed
33 - 'not "{{ collectd5_container_name }}" in output.stdout'
34 - 'not "{{ collectd6_container_name }}" in output.stdout'
35 - 'not "{{ flask_container_name }}" in output.stdout'
37 - name: Build collectd containers
47 COLLECTD_PULL_REQUESTS: "{{ PR | default() }}"
48 COLLECTD_CONFIG_CMD_ARGS: "{{ '--enable-' + new_plugin if new_plugin is defined }}"
50 - name: "Set up config for write_http plugin"
52 collectd_plugins: "{{ collectd_plugins | default([]) | union(['write_http']) }}"
53 collectd_plugin_write_http_nodes:
55 url: http://localhost:5000
58 - name: Generate collectd configs
62 # Since I can't skip-tags here, I have to remove the plugins later
63 # TODO(efoley) Add a disable_plugins and enable_plugins list to
64 # roles/config_files, as an alternative to tags.
65 # This alternative is kinda needed anyway, so that it's easier to add extra
66 # plugins instead of using.
67 # ``{{ collectd_plugins | default([]) | union(['the_plugin_i_want_to_enable'])}}``
68 # Tags can stay, since they are convenient, and easier to pass to the
69 # command line than a list of plugins
70 - name: "Remove plugin configs"
72 path: "/opt/collectd/etc/collectd.conf.d/{{ item }}.conf"
78 # TODO(efoley): The path here should be parameterised, to a degree, I don't
79 # want it to be repeated. And I shouldn't assume that this is always going
80 # to be the value (unless it is in vars/main instead of defaults/main)
81 - name: "Remove plugin configs (collectd 6)"
83 path: "/opt/collectd/etc/collectd.conf.d/{{ item }}.conf"
96 - name: Run the collectd-6 container
100 collectd_image_name: "opnfv/barometer-collectd-6{{ '-' + PR if PR is defined }}"
101 collectd_container_name: "{{ collectd6_container_name }}"
103 - name: Run the collectd-latest container
107 collectd_image_name: opnfv/barometer-collectd-latest
108 collectd_container_name: "{{ collectd5_container_name }}"
110 - name: Run the flask test container
112 name: "{{ flask_container_name }}"
113 image: test-collectd-write_http
117 published_ports: 5000:5000
119 - name: Check output for flask app
122 docker logs {{ flask_container_name }} {{ '| grep "' + new_plugin + '"' if new_plugin is defined }} | tail -200
126 var: output.stdout_lines
128 - name: Get a list of running containers
134 - name: Make sure that the expected containers are running
137 - '"{{ collectd6_container_name }}" in output.stdout'
138 - '"{{ collectd5_container_name }}" in output.stdout'
139 - '"{{ flask_container_name }}" in output.stdout'
141 # Create a small report at the end for collectd versions...
142 # Update Apply PRs to check out a branch when it is a single PR
143 # OR update these playbooks to use the tag way of checking out a PR