Adding tests for checking updating of templates
Need add checks for testing updating of sahara resources Change-Id: Ifeb9a312236753884ef3f120f1ae579dcb77b4ed
This commit is contained in:
parent
6b7e82863d
commit
8b7fc09bcb
|
@ -70,6 +70,17 @@ class ClusterTemplateTest(base.BaseDataProcessingTest):
|
|||
self.assertEqual(template_name, template.name)
|
||||
self.assertDictContainsSubset(self.cluster_template, template.__dict__)
|
||||
|
||||
def _check_cluster_template_update(self, template_id):
|
||||
values = {
|
||||
'name': data_utils.rand_name('updated-sahara-ct'),
|
||||
'description': 'description',
|
||||
}
|
||||
|
||||
# check updating of cluster template
|
||||
template = self.client.cluster_templates.update(
|
||||
template_id, **values)
|
||||
self.assertDictContainsSubset(values, template.__dict__)
|
||||
|
||||
def _check_cluster_template_delete(self, template_id):
|
||||
# delete cluster template by id
|
||||
self.client.cluster_templates.delete(
|
||||
|
@ -84,4 +95,5 @@ class ClusterTemplateTest(base.BaseDataProcessingTest):
|
|||
template_id, template_name = self._check_create_cluster_template()
|
||||
self._check_cluster_template_list(template_id, template_name)
|
||||
self._check_cluster_template_get(template_id, template_name)
|
||||
self._check_cluster_template_update(template_id)
|
||||
self._check_cluster_template_delete(template_id)
|
||||
|
|
|
@ -43,6 +43,18 @@ class DataSourceTest(base.BaseDataProcessingTest):
|
|||
self.assertEqual(source_name, source.name)
|
||||
self.assertDictContainsSubset(source_body, source.__dict__)
|
||||
|
||||
def _check_data_source_update(self, source_id):
|
||||
values = {
|
||||
'name': data_utils.rand_name('updated-sahara-data-source'),
|
||||
'description': 'description',
|
||||
'type': 'hdfs',
|
||||
'url': 'hdfs://user/foo'
|
||||
}
|
||||
|
||||
source = self.client.data_sources.update(source_id, values)
|
||||
|
||||
self.assertDictContainsSubset(values, source.data_source)
|
||||
|
||||
def _check_data_source_delete(self, source_id):
|
||||
# delete data source
|
||||
self.client.data_sources.delete(source_id)
|
||||
|
@ -80,4 +92,5 @@ class DataSourceTest(base.BaseDataProcessingTest):
|
|||
self._check_data_source_list(source_id, source_name)
|
||||
self._check_data_source_get(source_id, source_name,
|
||||
self.external_hdfs_data_source)
|
||||
self._check_data_source_update(source_id)
|
||||
self._check_data_source_delete(source_id)
|
||||
|
|
|
@ -69,6 +69,15 @@ class JobBinariesTest(base.BaseDataProcessingTest):
|
|||
self.assertEqual(binary_name, binary.name)
|
||||
self.assertDictContainsSubset(self.swift_job_binary, binary.__dict__)
|
||||
|
||||
def _check_swift_job_binary_update(self, binary_id):
|
||||
values = {
|
||||
'url': 'swift://user/foo',
|
||||
'description': 'description'
|
||||
}
|
||||
# check updating of job binary in swift
|
||||
binary = self.client.job_binaries.update(binary_id, values)
|
||||
self.assertDictContainsSubset(values, binary.__dict__)
|
||||
|
||||
def _check_internal_db_job_binary_create(self):
|
||||
name = data_utils.rand_name('sahara-internal-job-binary')
|
||||
self.job_binary_data = 'Some data'
|
||||
|
@ -96,6 +105,14 @@ class JobBinariesTest(base.BaseDataProcessingTest):
|
|||
self.assertEqual(binary_name, binary.name)
|
||||
self.assertDictContainsSubset(self.internal_db_binary, binary.__dict__)
|
||||
|
||||
def _check_internal_db_job_binary_update(self, binary_id):
|
||||
values = {
|
||||
'description': 'description'
|
||||
}
|
||||
# check updating of job binary in internal db
|
||||
binary = self.client.job_binaries.update(binary_id, values)
|
||||
self.assertDictContainsSubset(values, binary.__dict__)
|
||||
|
||||
def _check_job_binary_get_file(self, binary_id):
|
||||
data = self.client.job_binaries.get_file(binary_id)
|
||||
self.assertEqual(self.job_binary_data, data)
|
||||
|
@ -105,6 +122,7 @@ class JobBinariesTest(base.BaseDataProcessingTest):
|
|||
binary_id, binary_name = self._check_swift_job_binary_create()
|
||||
self._check_job_binary_list(binary_id, binary_name)
|
||||
self._check_swift_job_binary_get(binary_id, binary_name)
|
||||
self._check_swift_job_binary_update(binary_id)
|
||||
self._check_job_binary_delete(binary_id)
|
||||
|
||||
@test.services('data_processing')
|
||||
|
@ -113,4 +131,5 @@ class JobBinariesTest(base.BaseDataProcessingTest):
|
|||
self._check_job_binary_list(binary_id, binary_name)
|
||||
self._check_internal_db_job_binary_get(binary_id, binary_name)
|
||||
self._check_job_binary_get_file(binary_id)
|
||||
self._check_internal_db_job_binary_update(binary_id)
|
||||
self._check_job_binary_delete(binary_id)
|
||||
|
|
|
@ -133,6 +133,15 @@ class JobExecutionTest(base.BaseDataProcessingTest):
|
|||
self.assertEqual(cluster_name, cluster.name)
|
||||
self.assertDictContainsSubset(self.cluster_info, cluster.__dict__)
|
||||
|
||||
def _check_cluster_update(self, cluster_id):
|
||||
values = {
|
||||
'name': data_utils.rand_name('updated-sahara-cluster'),
|
||||
'description': 'description'
|
||||
}
|
||||
# check updating of cluster
|
||||
cluster = self.client.clusters.update(cluster_id)
|
||||
self.assertDictContainsSubset(values, cluster.__dict__)
|
||||
|
||||
def _check_cluster_scale(self, cluster_id):
|
||||
big_worker = self.create_node_group_template(
|
||||
data_utils.rand_name('sahara-ng-template'), **self.worker_template)
|
||||
|
@ -259,6 +268,13 @@ class JobExecutionTest(base.BaseDataProcessingTest):
|
|||
del job_exec_info['configs']
|
||||
self.assertDictContainsSubset(job_exec_info, job_exec.__dict__)
|
||||
|
||||
def _check_job_execution_update(self, job_exec_id):
|
||||
values = {
|
||||
'is_public': True
|
||||
}
|
||||
job_exec = self.client.job_executions.update(job_exec_id, **values)
|
||||
self.assertDictContainsSubset(values, job_exec.__dict__)
|
||||
|
||||
def _check_job_execution_delete(self, job_exec_id):
|
||||
# delete job_execution by id
|
||||
self.client.job_executions.delete(job_exec_id)
|
||||
|
@ -280,11 +296,13 @@ class JobExecutionTest(base.BaseDataProcessingTest):
|
|||
cluster_id, cluster_name = self._check_cluster_create()
|
||||
self._check_cluster_list(cluster_id, cluster_name)
|
||||
self._check_cluster_get(cluster_id, cluster_name)
|
||||
self._check_cluster_update(cluster_id)
|
||||
self._check_cluster_scale(cluster_id)
|
||||
|
||||
job_exec_id = self._check_job_execution_create(cluster_id)
|
||||
self._check_job_execution_list(job_exec_id)
|
||||
self._check_job_execution_get(job_exec_id)
|
||||
self._check_job_execution_update(job_exec_id)
|
||||
|
||||
self._check_job_execution_delete(job_exec_id)
|
||||
self._check_cluster_delete(cluster_id)
|
||||
|
|
|
@ -55,6 +55,16 @@ class JobTest(base.BaseDataProcessingTest):
|
|||
job = self.client.jobs.get(job_id)
|
||||
self.assertEqual(job_name, job.name)
|
||||
|
||||
def _check_job_update(self, job_id):
|
||||
# check updating of job
|
||||
values = {
|
||||
'name': data_utils.rand_name('updated-sahara-job'),
|
||||
'description': 'description'
|
||||
|
||||
}
|
||||
job = self.client.jobs.update(job_id, **values)
|
||||
self.assertDictContainsSubset(values, job.job)
|
||||
|
||||
def _check_delete_job(self, job_id):
|
||||
# delete job by id
|
||||
self.client.jobs.delete(job_id)
|
||||
|
@ -67,4 +77,5 @@ class JobTest(base.BaseDataProcessingTest):
|
|||
job_id, job_name = self._check_create_job()
|
||||
self._check_job_list(job_id, job_name)
|
||||
self._check_get_job(job_id, job_name)
|
||||
self._check_job_update(job_id)
|
||||
self._check_delete_job(job_id)
|
||||
|
|
|
@ -47,6 +47,19 @@ class NodeGroupTemplateTest(base.BaseDataProcessingTest):
|
|||
self.assertDictContainsSubset(self.worker_template,
|
||||
template.__dict__)
|
||||
|
||||
def _check_create_node_group_template_update(self, template_id):
|
||||
values = {
|
||||
'name': data_utils.rand_name('updated-sahara-ng-template'),
|
||||
'description': 'description',
|
||||
'volumes_per_node': 2,
|
||||
'volumes_size': 2,
|
||||
}
|
||||
|
||||
resp_body = self.update_node_group_template(template_id, **values)
|
||||
# check that template updated successfully
|
||||
self.assertDictContainsSubset(values,
|
||||
resp_body.__dict__)
|
||||
|
||||
def _check_node_group_template_delete(self, template_id):
|
||||
# delete node group template by id
|
||||
self.client.node_group_templates.delete(template_id)
|
||||
|
|
Loading…
Reference in New Issue