diff --git a/sahara/tests/integration/tests/base.py b/sahara/tests/integration/tests/base.py index 9c07333b..7941d104 100644 --- a/sahara/tests/integration/tests/base.py +++ b/sahara/tests/integration/tests/base.py @@ -421,6 +421,34 @@ class ITestCase(testcase.WithAttributes, base.BaseTestCase): % self.common_config.HDFS_INITIALIZATION_TIMEOUT) self.close_ssh_connection() + @errormsg("Failure while event log testing: ") + def _test_event_log(self, cluster_id): + cluster = self.sahara.clusters.get(cluster_id) + events = self.sahara.events.list(cluster_id) + + invalid_steps = [] + if not events: + events = [] + + for step in cluster.provision_progress: + if not step['successful']: + invalid_steps.append(step) + + if len(invalid_steps) > 0 or len(events) > 0: + events_info = "\n".join(six.text_type(e) for e in events) + invalid_steps_info = "\n".join(six.text_type(e) + for e in invalid_steps) + steps_info = "\n".join(six.text_type(e) + for e in cluster.provision_progress) + self.fail( + "Issues with event log work: " + "\n Not removed events: \n\n {events}" + "\n Incomplete steps: \n\n {invalid_steps}" + "\n All steps: \n\n {steps}".format( + events=events_info, + steps=steps_info, + invalid_steps=invalid_steps_info)) + # --------------------------------Remote--------------------------------------- def connect_to_swift(self): diff --git a/sahara/tests/integration/tests/gating/test_cdh_gating.py b/sahara/tests/integration/tests/gating/test_cdh_gating.py index a1bedf6f..21352b9d 100644 --- a/sahara/tests/integration/tests/gating/test_cdh_gating.py +++ b/sahara/tests/integration/tests/gating/test_cdh_gating.py @@ -374,6 +374,7 @@ class CDHGatingTest(check_services.CheckServicesTest, self._create_nm_dn_ng_template() self._create_cluster_template() self._create_cluster() + self._test_event_log(self.cluster_id) self._check_cinder() self._check_mapreduce() @@ -382,6 +383,7 @@ class CDHGatingTest(check_services.CheckServicesTest, if not self.plugin_config.SKIP_SCALING_TEST: self._check_scaling() + self._test_event_log(self.cluster_id) self._check_cinder_after_scaling() self._check_edp_after_scaling() self._check_mapreduce_after_scaling() diff --git a/sahara/tests/integration/tests/gating/test_hdp2_gating.py b/sahara/tests/integration/tests/gating/test_hdp2_gating.py index baf52dbc..5376d300 100644 --- a/sahara/tests/integration/tests/gating/test_hdp2_gating.py +++ b/sahara/tests/integration/tests/gating/test_hdp2_gating.py @@ -207,12 +207,13 @@ class HDP2GatingTest(swift.SwiftTest, scaling.ScalingTest, self._create_nm_dn_ng_template() self._create_cluster_template() self._create_cluster() - + self._test_event_log(self.cluster_id) self._check_swift() self._check_edp() if not self.plugin_config.SKIP_SCALING_TEST: self._check_scaling() + self._test_event_log(self.cluster_id) self._check_swift_after_scaling() self._check_edp_after_scaling() diff --git a/sahara/tests/integration/tests/gating/test_hdp_gating.py b/sahara/tests/integration/tests/gating/test_hdp_gating.py index 2d590d1d..b4752933 100644 --- a/sahara/tests/integration/tests/gating/test_hdp_gating.py +++ b/sahara/tests/integration/tests/gating/test_hdp_gating.py @@ -130,7 +130,10 @@ class HDPGatingTest(cinder.CinderVolumeTest, edp.EDPTest, message = 'Failure while cluster creation: ' self.print_error_log(message, e) -# --------------------------------CINDER TESTING------------------------------- +# --------------------------------EVENT LOG TESTING--------------------------- + self._test_event_log(cluster_id) + +# --------------------------------CINDER TESTING------------------------------ try: self.cinder_volume_testing(cluster_info) @@ -226,7 +229,7 @@ class HDPGatingTest(cinder.CinderVolumeTest, edp.EDPTest, message = 'Failure during check of Swift availability: ' self.print_error_log(message, e) -# -------------------------------CLUSTER SCALING------------------------------- +# -------------------------------CLUSTER SCALING------------------------------ if not self.plugin_config.SKIP_SCALING_TEST: datanode_count_after_resizing = ( @@ -261,7 +264,10 @@ class HDPGatingTest(cinder.CinderVolumeTest, edp.EDPTest, message = 'Failure while cluster scaling: ' self.print_error_log(message, e) -# -------------------------CINDER TESTING AFTER SCALING------------------------ +# --------------------------------EVENT LOG TESTING--------------------------- + self._test_event_log(cluster_id) + +# -------------------------CINDER TESTING AFTER SCALING----------------------- try: self.cinder_volume_testing(new_cluster_info) diff --git a/sahara/tests/integration/tests/gating/test_spark_gating.py b/sahara/tests/integration/tests/gating/test_spark_gating.py index ba3ebd2e..edbdcb15 100644 --- a/sahara/tests/integration/tests/gating/test_spark_gating.py +++ b/sahara/tests/integration/tests/gating/test_spark_gating.py @@ -146,11 +146,12 @@ class SparkGatingTest(swift.SwiftTest, scaling.ScalingTest, self._create_s_dn_ng_template() self._create_cluster_template() self._create_cluster() - + self._test_event_log(self.cluster_id) self._check_edp() if not self.plugin_config.SKIP_SCALING_TEST: self._check_scaling() + self._test_event_log(self.cluster_id) self._check_edp_after_scaling() def tearDown(self): diff --git a/sahara/tests/integration/tests/gating/test_transient_gating.py b/sahara/tests/integration/tests/gating/test_transient_gating.py index 7494306f..cad8e1bb 100644 --- a/sahara/tests/integration/tests/gating/test_transient_gating.py +++ b/sahara/tests/integration/tests/gating/test_transient_gating.py @@ -135,4 +135,7 @@ class TransientGatingTest(edp.EDPTest): self._prepare_test() self._create_cluster_template() self._create_cluster() + for cluster_id in self.cluster_ids: + self._test_event_log(cluster_id) + self._check_transient() diff --git a/sahara/tests/integration/tests/gating/test_vanilla_gating.py b/sahara/tests/integration/tests/gating/test_vanilla_gating.py index f469b1f1..b1403460 100644 --- a/sahara/tests/integration/tests/gating/test_vanilla_gating.py +++ b/sahara/tests/integration/tests/gating/test_vanilla_gating.py @@ -293,13 +293,16 @@ class VanillaGatingTest(cinder.CinderVolumeTest, self._create_dn_ng_template() self._create_cluster_template() self._create_cluster() + self._test_event_log(self.cluster_id) self._check_cinder() self._check_cluster_config() self._check_edp() self._check_mapreduce() self._check_swift() + if not self.plugin_config.SKIP_SCALING_TEST: self._check_scaling() + self._test_event_log(self.cluster_id) self._check_cinder_after_scaling() self._check_cluster_config_after_scaling() self._check_mapredure_after_scaling() diff --git a/sahara/tests/integration/tests/gating/test_vanilla_two_gating.py b/sahara/tests/integration/tests/gating/test_vanilla_two_gating.py index 20540fe2..ad74ffeb 100644 --- a/sahara/tests/integration/tests/gating/test_vanilla_two_gating.py +++ b/sahara/tests/integration/tests/gating/test_vanilla_two_gating.py @@ -328,6 +328,7 @@ class VanillaTwoGatingTest(cluster_configs.ClusterConfigTest, self._create_dn_ng_template() self._create_cluster_template() self._create_cluster() + self._test_event_log(self.cluster_id) self._check_cinder() self._check_mapreduce() @@ -336,6 +337,7 @@ class VanillaTwoGatingTest(cluster_configs.ClusterConfigTest, if not self.plugin_config.SKIP_SCALING_TEST: self._check_scaling() + self._test_event_log(self.cluster_id) self._check_cinder_after_scaling() self._check_mapreduce_after_scaling() self._check_swift_after_scaling()