Пример #1
0
    def test_wait_default_juju_env(self, default_env, waiter_status):
        if not os.path.exists('/tmp/juju-home'):
            os.makedirs('/tmp/juju-home')
        envyaml = yaml.dump({'default': 'testing-default-env',
                             'environments': {'testing-default-env':
                                              {'type': 'local'}}})
        with open('/tmp/juju-home/environments.yaml', 'w') as f:
            f.write(envyaml)

        waiter_status.return_value = {'test': {'0': 'started'}}
        default_env.return_value = 'testing-default-env'
        try:
            wait()
        finally:
            os.remove('/tmp/juju-home/environments.yaml')
            os.removedirs('/tmp/juju-home')

        waiter_status.assert_called_with(juju_env='testing-default-env')
Пример #2
0
    def test_wait_default_juju_env(self, default_env, waiter_status):
        if not os.path.exists('/tmp/juju-home'):
            os.makedirs('/tmp/juju-home')
        envyaml = yaml.dump({'default': 'testing-default-env',
                             'environments': {'testing-default-env':
                                              {'type': 'local'}}})
        with open('/tmp/juju-home/environments.yaml', 'w') as f:
            f.write(envyaml)

        waiter_status.return_value = {'test': {'0': 'started'}}
        default_env.return_value = 'testing-default-env'
        try:
            wait()
        finally:
            os.remove('/tmp/juju-home/environments.yaml')
            os.removedirs('/tmp/juju-home')

        waiter_status.assert_called_with(juju_env='testing-default-env')
Пример #3
0
    def test_wait_not_ready(self, waiter_status):
        waiter_status.side_effect = [{
            'test': {
                '0': 'pending'
            }
        }, {
            'test': {
                '0': 'started'
            }
        }]

        self.assertTrue(wait(juju_env='dummy', timeout=1))
Пример #4
0
 def test_wait_default_juju_env(self, default_env, waiter_status):
     waiter_status.return_value = {'test': {'0': 'started'}}
     default_env.return_value = 'testing-default-env'
     wait()
     waiter_status.assert_called_with(juju_env='testing-default-env')
Пример #5
0
    def test_wait(self, waiter_status):
        waiter_status.return_value = {'test': {'0': 'started'}}

        self.assertTrue(wait(juju_env='dummy', timeout=1))
        waiter_status.assert_called_with(juju_env='dummy')
Пример #6
0
    def test_wait_not_ready(self, waiter_status):
        waiter_status.side_effect = [{'test': {'0': 'pending'}},
                                     {'test': {'0': 'started'}}]

        self.assertTrue(wait(juju_env='dummy', timeout=1))
Пример #7
0
 def test_wait_juju_env(self, waiter_status):
     waiter_status.return_value = {'test': {'0': 'started'}}
     wait()
     waiter_status.assert_called_with(juju_env='testing-env')
Пример #8
0
    def test_wait(self, waiter_status):
        waiter_status.return_value = {'test': {'0': 'started'}}

        self.assertTrue(wait(juju_env='dummy', timeout=1))
        waiter_status.assert_called_with(juju_env='dummy')
Пример #9
0
 def test_wait_juju_model(self, waiter_status):
     waiter_status.return_value = {'test': {'0': 'started'}}
     wait()
     waiter_status.assert_called_with(juju_env='testing-env')