Add a playbook that tests collectd 6 vs collectd5
[barometer.git] / docs / testing / index.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) Anuket and others
4
5 ==============================
6 Anuket Barometer testing guide
7 ==============================
8
9 This document will describe how to use different tests in this repo.
10
11 There are a number of tools and scripts in Barometer that can be used for testing, whether that is during development, building, code reviews, or run regularly in CI.
12 Some of the tests are automated, and cover building collectd, others cover particular plugins.
13
14 .. TODO: This guide should also include how to manually verify that collectd plugins are working as expected.
15
16 .. TODO: There might be some troubleshooting guide in here too.
17
18 Porting collectd to version 6
19 =============================
20
21 Thre is an ansible playbook for building and running collectd 5 and 6 together to compare the collected metrics.
22 This is intended to help test porting from collectd 5 to 6, and confirm equivalency across the versions.
23
24 The playbook will::
25
26   * build collectd-6, collectd-latest and flask app containers
27   * generate a set of collectd configs
28   * launch the collectd-6, collectd-latest with the generated configs
29   * run the flask app which has a http server that receives metrics from
30     collectd v5 and collectd v6
31   * display the received metrics from both versions of collectd
32     Collectd v5 shows PUTVAL
33     Collectd v6 shows PUTMETRIC
34
35 To run this comparison, use the following command::
36
37   $ cd docker/ansible/
38   $ sudo ansible-playbook -i default.inv collectd6_test.yml
39
40 The playbook takes the following parameters:
41
42   * PR (optional)
43     The PRID for an upstream collectd pull request that will be
44     passed to the collectd 6 container build
45
46   * plugin (optional)
47     The name of the plugin that is bneing ported
48     This will filter the received metrics to show the value passed.
49
50 To run the playbook with these configs, pass the extra var to ansible::
51
52   sudo ansible-playbook -i default.inv -e PR=<PR_ID> -e plugin=<plugin_name> collectd6_test.yml
53
54 The metrics can then be viewed by inspecting the container logs or attaching to the container to view the output::
55
56   $ docker attach <webserver-container>
57   $ #OR
58   $ docker logs <webserver-container>
59
60 Metrics from collectd 5 will appear preceeded with ``PUTVAL``, and metrics from collectd 6 will appear preceeded by ``PUTMETRIC``.
61
62 ::
63
64   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-mm-2048Kb/vmpage_number-free interval=10.000 1629466502.664:0
65   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-mm-2048Kb/vmpage_number-used interval=10.000 1629466502.664:0
66   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-mm-1048576Kb/vmpage_number-free interval=10.000 1629466502.664:0
67   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-mm-1048576Kb/vmpage_number-used interval=10.000 1629466502.664:0
68   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-node0-2048Kb/vmpage_number-free interval=10.000 1629466502.664:0
69   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-node0-2048Kb/vmpage_number-used interval=10.000 1629466502.664:0
70   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-node0-1048576Kb/vmpage_number-used interval=10.000 1629466502.665:0
71   PUTVAL fbae30cc-2f20-11b2-a85c-819293100691/hugepages-node0-1048576Kb/vmpage_number-free interval=10.000 1629466502.665:0
72   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.807 interval=10.000 label:hugepages="mm-2048Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="free" 0
73   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.807 interval=10.000 label:hugepages="mm-2048Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="used" 0
74   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.808 interval=10.000 label:hugepages="mm-1048576Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="free" 0
75   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.808 interval=10.000 label:hugepages="node0-2048Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="free" 0
76   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.808 interval=10.000 label:hugepages="node0-2048Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="used" 0
77   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.809 interval=10.000 label:hugepages="node0-1048576Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="free" 0
78   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.809 interval=10.000 label:hugepages="node0-1048576Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="used" 0
79   PUTMETRIC collectd_hugepages_vmpage_number type=GAUGE time=1629466501.808 interval=10.000 label:hugepages="mm-1048576Kb" label:instance="fbae30cc-2f20-11b2-a85c-819293100691" label:type="used" 0