~gz/juju-ci-tools/always_finish_reports

« back to all changes in this revision

Viewing changes to test_substrate.py

  • Committer: John George
  • Date: 2015-02-25 21:38:23 UTC
  • mfrom: (836.2.6 fetch_maas_logs)
  • Revision ID: john.george@canonical.com-20150225213823-ipln6duzhle1u7wv
Resolve MaaS DNS names against the server defined in the environment and use the IP to fetch logs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    AWSAccount,
23
23
    AzureAccount,
24
24
    get_libvirt_domstate,
 
25
    get_maas_ip_from_name,
25
26
    JoyentAccount,
26
27
    OpenStackAccount,
27
28
    make_substrate_manager,
690
691
        with patch('substrate.get_libvirt_domstate', return_value='shut off'):
691
692
            rval = verify_libvirt_domain(URI, dom_name, 'running')
692
693
        self.assertFalse(rval)
 
694
 
 
695
 
 
696
class TestGetMaaSIp(TestCase):
 
697
 
 
698
    def test_get_maas_ip_from_name(self):
 
699
        env = get_maas_env()
 
700
        with patch('subprocess.check_output',
 
701
                   return_value='10-0-20-171.maas.\n10.0.20.171') as cc_mock:
 
702
            returned_ip = get_maas_ip_from_name(env.config['maas-server'],
 
703
                                                'node.maas')
 
704
        expected = (
 
705
            ['dig', '@' + '10.0.10.10', 'node.maas', '+short'],
 
706
        )
 
707
        self.assertEqual(expected, cc_mock.call_args_list[0][0])
 
708
        self.assertEqual(returned_ip, '10.0.20.171')