def get_next_test_configs(plan_id): """ Gets information about the next planner test configs that need to be run @param plan_id: the ID or name of the test plan @return a dictionary: complete: True or False, shows test plan completion next_configs: a list of dictionaries: host: ID of the host next_test_config_id: ID of the next Planner test to run """ plan = models.Plan.smart_get(plan_id) result = {'next_configs': []} rpc_utils.update_hosts_table(plan) for host in models.Host.objects.filter(plan=plan): next_test_config = rpc_utils.compute_next_test_config(plan, host) if next_test_config: config = { 'next_test_config_id': next_test_config.id, 'next_test_config_alias': next_test_config.alias, 'host': host.host.hostname } result['next_configs'].append(config) rpc_utils.check_for_completion(plan) result['complete'] = plan.complete return result
def get_next_test_configs(plan_id): """ Gets information about the next planner test configs that need to be run @param plan_id: the ID or name of the test plan @return a dictionary: complete: True or False, shows test plan completion next_configs: a list of dictionaries: host: ID of the host next_test_config_id: ID of the next Planner test to run """ plan = models.Plan.smart_get(plan_id) result = {'next_configs': []} rpc_utils.update_hosts_table(plan) for host in models.Host.objects.filter(plan=plan): next_test_config = rpc_utils.compute_next_test_config(plan, host) if next_test_config: config = {'next_test_config_id': next_test_config.id, 'next_test_config_alias': next_test_config.alias, 'host': host.host.hostname} result['next_configs'].append(config) rpc_utils.check_for_completion(plan) result['complete'] = plan.complete return result
def test_update_hosts_table(self): label = self.labels[3] default_hosts = set(self._plan.hosts.all()) rpc_utils.update_hosts_table(self._plan) self.assertEqual(default_hosts, set(self._plan.hosts.all())) self.assertEqual(set(), self._get_added_by_label_hosts()) self._plan.host_labels.add(label) rpc_utils.update_hosts_table(self._plan) self.assertEqual(default_hosts.union(label.host_set.all()), set(self._plan.hosts.all())) self.assertEqual(set(label.host_set.all()), self._get_added_by_label_hosts()) self._plan.host_labels.remove(label) rpc_utils.update_hosts_table(self._plan) self.assertEqual(default_hosts, set(self._plan.hosts.all())) self.assertEqual(set(), self._get_added_by_label_hosts())