示例#1
0
    def test_get_status_done(self, m_zk_c):
        m_zk_c.return_value.__enter__.return_value = self.client
        tasks = show_tasks.get_tasks(self.dep_id)
        # just get what we want for the test
        test_tasks = {'/cinder/cinder-api/db_sync':
                      tasks['/cinder/cinder-api/db_sync']}
        var = '/kolla/test/status'
        at = '%s/cinder_ansible_tasks' % var
        exp = {
            'register': ('%s/cinder-api/db_sync/.done' % var, 'done'),
            'requirements': {
                '%s/create_database/.done' % at: 'done',
                '%s/database_user_create/.done' % at: 'done'}}

        # create the .done nodes
        self.client.create(
            '%s/cinder_ansible_tasks/create_database/.done' % var,
            'foo', makepath=True)
        self.client.create(
            '%s/cinder_ansible_tasks/database_user_create/.done' % var,
            'foo', makepath=True)
        self.client.create('%s/cinder-api/db_sync/.done' % var, 'foo',
                           makepath=True)

        status = show_tasks.get_status(test_tasks)
        self.assertEqual({'/cinder/cinder-api/db_sync': exp}, status)
示例#2
0
    def test_get_tasks_sanity(self):
        var = '/kolla/test/status'
        exp = {'register': '%s/cinder-api/db_sync/.done' % var,
               'requires': [
                   '%s/cinder_ansible_tasks/create_database/.done' % var,
                   '%s/cinder_ansible_tasks/database_user_create/.done' % var]}

        tasks = show_tasks.get_tasks(self.dep_id)
        self.assertEqual(exp, tasks['/cinder/cinder-api/db_sync'])
示例#3
0
 def test_get_status_waiting(self, m_zk_c):
     m_zk_c.return_value.__enter__.return_value = self.client
     tasks = show_tasks.get_tasks(self.dep_id)
     # just get what we want for the test
     test_tasks = {'/cinder/cinder-api/db_sync':
                   tasks['/cinder/cinder-api/db_sync']}
     var = '/kolla/test/status'
     exp = {
         'register': ('%s/cinder-api/db_sync/.done' % var, 'waiting'),
         'requirements': {
             '%s/cinder_ansible_tasks/create_database/.done' % var: '',
             '%s/cinder_ansible_tasks/database_user_create/.done' % var: ''}
     }
     status = show_tasks.get_status(test_tasks)
     self.assertEqual({'/cinder/cinder-api/db_sync': exp}, status)