Add tests for gnocchi states and modules
Depends-On: I7341dfb26a39275e1a9b55f7a49fd2ace9584612
Change-Id: Ie3dcfe13550a0bc541ddd8d0f1895757526e1d89
Related-Prod: https://mirantis.jira.com/browse/PROD-20719
diff --git a/runtest/salttest/modules/openstack/gnocchi.sls b/runtest/salttest/modules/openstack/gnocchi.sls
new file mode 100644
index 0000000..1c1b663
--- /dev/null
+++ b/runtest/salttest/modules/openstack/gnocchi.sls
@@ -0,0 +1,104 @@
+{%- set archive_policy_name = 'salttest_archive_policy' %}
+{%- set archive_policy_rule_name = archive_policy_name + '_rule' %}
+gnocchi_archive_policy_create:
+ module.run:
+ - name: gnocchiv1.archive_policy_create
+ - kwargs:
+ name: {{ archive_policy_name }}
+ definition:
+ - granularity: '1h'
+ points: 100
+ timespan: '100h'
+ - granularity: '2h'
+ points: 100
+ timespan: '200h'
+ aggregation_methods:
+ - mean
+ - count
+ - max
+ back_window: 2
+ cloud_name: admin_identity
+
+gnocchi_archive_policy_list:
+ module.run:
+ - name: gnocchiv1.archive_policy_list
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_create
+
+gnocchi_archive_policy_read:
+ module.run:
+ - name: gnocchiv1.archive_policy_read
+ - args:
+ - {{ archive_policy_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_list
+
+gnocchi_archive_policy_update:
+ module.run:
+ - name: gnocchiv1.archive_policy_update
+ - args:
+ - {{ archive_policy_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ definition:
+ - granularity: '1h'
+ points: 300
+ timespan: '300h'
+ - granularity: '2h'
+ points: 400
+ timespan: '800h'
+ - require:
+ - gnocchi_archive_policy_read
+
+gnocchi_archive_policy_rule_create:
+ module.run:
+ - name: gnocchiv1.archive_policy_rule_create
+ - kwargs:
+ name: {{ archive_policy_rule_name }}
+ archive_policy_name: {{ archive_policy_name }}
+ metric_pattern: 'disk.*'
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_update
+
+gnocchi_archive_policy_rule_list:
+ module.run:
+ - name: gnocchiv1.archive_policy_rule_list
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_rule_create
+
+gnocchi_archive_policy_rule_read:
+ module.run:
+ - name: gnocchiv1.archive_policy_rule_read
+ - args:
+ - {{ archive_policy_rule_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_rule_list
+
+gnocchi_archive_policy_rule_delete:
+ module.run:
+ - name: gnocchiv1.archive_policy_rule_delete
+ - args:
+ - {{ archive_policy_rule_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_rule_list
+
+gnocchi_archive_policy_delete:
+ module.run:
+ - name: gnocchiv1.archive_policy_delete
+ - args:
+ - {{ archive_policy_name }}
+ - kwargs:
+ cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_rule_delete
diff --git a/runtest/salttest/states/openstack/gnocchi.sls b/runtest/salttest/states/openstack/gnocchi.sls
new file mode 100644
index 0000000..498df94
--- /dev/null
+++ b/runtest/salttest/states/openstack/gnocchi.sls
@@ -0,0 +1,40 @@
+gnocchi_archive_policy_present:
+ gnocchiv1.archive_policy_present:
+ - name: SaltTestArchivePolicy
+ - cloud_name: admin_identity
+ - definition:
+ - granularity: '1:00:00'
+ points: 100
+ timespan: '100h'
+ - granularity: '2:00:00'
+ points: 100
+ timespan: '200h'
+ - aggregation_methods:
+ - mean
+ - count
+ - max
+ - back_window: 2
+
+gnocchi_archive_policy_rule_present:
+ gnocchiv1.archive_policy_rule_present:
+ - name: SaltTestArchivePolicy_rule
+ - cloud_name: admin_identity
+ - metric_pattern: 'disk.*'
+ - archive_policy_name: SaltTestArchivePolicy
+ - require:
+ - gnocchi_archive_policy_present
+
+gnocchi_archive_policy_rule_absent:
+ gnocchiv1.archive_policy_rule_absent:
+ - name: SaltTestArchivePolicy_rule
+ - cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_rule_present
+
+
+gnocchi_archive_policy_absent:
+ gnocchiv1.archive_policy_absent:
+ - name: SaltTestArchivePolicy
+ - cloud_name: admin_identity
+ - require:
+ - gnocchi_archive_policy_rule_absent