diff --git a/stacklight_tests/helpers/helpers.py b/stacklight_tests/helpers/helpers.py index b85036e..0998ee3 100644 --- a/stacklight_tests/helpers/helpers.py +++ b/stacklight_tests/helpers/helpers.py @@ -18,6 +18,7 @@ import time import urllib2 from devops.helpers import helpers +from fuelweb_test.helpers import checkers from fuelweb_test import logger from proboscis import asserts @@ -107,6 +108,14 @@ class PluginHelper(object): def run_ostf(self, *args, **kwargs): self.fuel_web.run_ostf(self.cluster_id, *args, **kwargs) + def run_single_ostf(self, test_sets, test_name, *args, **kwargs): + self.fuel_web.run_single_ostf_test(self.cluster_id, test_sets, + test_name, *args, **kwargs) + + def verify_service(self, ip, service_name, count): + with self.env.d_env.get_ssh_to_remote(ip) as remote: + checkers.verify_service(remote, service_name, count) + def add_node_to_cluster(self, node, redeploy=True, check_services=False): """Method to add node to cluster :param node: node to add to cluster diff --git a/stacklight_tests/lma_collector/api.py b/stacklight_tests/lma_collector/api.py index 7bcfa44..43c4234 100644 --- a/stacklight_tests/lma_collector/api.py +++ b/stacklight_tests/lma_collector/api.py @@ -11,6 +11,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from fuelweb_test import logger from stacklight_tests import base_test from stacklight_tests.lma_collector import plugin_settings @@ -31,4 +32,17 @@ class LMACollectorPluginApi(base_test.PluginApi): pass def check_plugin_online(self): - pass + # Run OSTF test to check pacemaker status + self.helpers.run_single_ostf( + test_sets=['ha'], + test_name='fuel_health.tests.ha.test_pacemaker_status.' + 'TestPacemakerStatus.test_check_pacemaker_resources') + + # Check that heka and collectd processes are started on all nodes + nodes = self.helpers.get_all_ready_nodes() + msg = "Check services on the {} node" + for node in nodes: + logger.info(msg.format(node['name'])) + _ip = node['ip'] + self.helpers.verify_service(_ip, 'hekad', 2) + self.helpers.verify_service(_ip, 'collectd -C', 1) diff --git a/stacklight_tests/lma_collector/plugin_settings.py b/stacklight_tests/lma_collector/plugin_settings.py index 6caacdb..76e401c 100644 --- a/stacklight_tests/lma_collector/plugin_settings.py +++ b/stacklight_tests/lma_collector/plugin_settings.py @@ -24,7 +24,9 @@ version = helpers.get_plugin_version(plugin_path) options = { 'environment_label/value': 'deploy_lma_toolchain', - 'elasticsearch_mode/value': 'local', - 'influxdb_mode/value': 'local', + 'elasticsearch_mode/value': 'remote', + 'influxdb_mode/value': 'remote', 'alerting_mode/value': 'local', + 'elasticsearch_address/value': '127.0.0.1', + 'influxdb_address/value': '127.0.0.1' } diff --git a/stacklight_tests/lma_collector/test_smoke_bvt.py b/stacklight_tests/lma_collector/test_smoke_bvt.py index d9e6699..9919c0d 100644 --- a/stacklight_tests/lma_collector/test_smoke_bvt.py +++ b/stacklight_tests/lma_collector/test_smoke_bvt.py @@ -11,7 +11,6 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - from fuelweb_test.helpers.decorators import log_snapshot_after_test from proboscis import test @@ -44,3 +43,91 @@ class TestLMACollectorPlugin(api.LMACollectorPluginApi): self.create_cluster() self.activate_plugin() + + @test(depends_on_groups=["prepare_slaves_3"], + groups=["deploy_lma_collector", "deploy", "lma_collector", "smoke"]) + @log_snapshot_after_test + def deploy_lma_collector(self): + """Deploy a cluster with the LMA Collector plugin + + Scenario: + 1. Upload plugin to the master node + 2. Install plugin + 3. Create cluster + 4. Add 1 node with controller role + 5. Add 1 node with compute role + 6. Deploy the cluster + 7. Check that plugin is working + 8. Run OSTF + + Duration 60m + Snapshot deploy_lma_collector + """ + + self.check_run('deploy_lma_collector') + + self.env.revert_snapshot("ready_with_3_slaves") + + self.prepare_plugin() + + self.create_cluster() + + self.activate_plugin() + + self.helpers.deploy_cluster( + { + 'slave-01': ['controller'], + 'slave-02': ['compute'] + } + ) + + self.check_plugin_online() + + self.helpers.run_ostf() + + self.env.make_snapshot("deploy_lma_collector", is_make=True) + + @test(depends_on=[deploy_lma_collector], + groups=["uninstall_deployed_lma_collector", "uninstall", + "lma_collector", "smoke"]) + @log_snapshot_after_test + def uninstall_deployed_lma_collector(self): + """Uninstall the plugin with deployed environment + + Scenario: + 1. Try to remove the plugins using the Fuel CLI + 2. Remove the environment. + 3. Remove the plugins. + + Duration 20m + """ + self.env.revert_snapshot("deploy_lma_collector") + + self.helpers.uninstall_plugin( + self.settings.name, self.settings.version, 1, + 'Plugin deletion must not be permitted when the plugin is active ' + 'for one environment') + + self.fuel_web.delete_env_wait(self.helpers.cluster_id) + self.helpers.uninstall_plugin(self.settings.name, + self.settings.version) + + @test(depends_on_groups=["prepare_slaves_3"], + groups=["uninstall_lma_collector", "uninstall", "lma_collector", + "smoke"]) + @log_snapshot_after_test + def uninstall_lma_collector(self): + """Uninstall the plugins + + Scenario: + 1. Install plugin. + 2. Remove the plugins. + + Duration 5m + """ + self.env.revert_snapshot("ready_with_3_slaves") + + self.prepare_plugin() + + self.helpers.uninstall_plugin(self.settings.name, + self.settings.version) diff --git a/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py b/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py index 8c14ea4..58a3be2 100644 --- a/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py +++ b/stacklight_tests/lma_infrastructure_alerting/test_smoke_bvt.py @@ -144,7 +144,7 @@ class TestLMAInfraAlertingPlugin(api.InfraAlertingPluginApi): self.env.make_snapshot("deploy_ha_lma_infrastructure_alerting", is_make=True) - @test(depends_on=[deploy_ha_lma_infrastructure_alerting], + @test(depends_on=[deploy_lma_infrastructure_alerting], groups=["uninstall_deployed_lma_infrastructure_alerting", "uninstall", "lma_infrastructure_alerting", "smoke"]) @log_snapshot_after_test