示例#1
0
 def test_collect_heat_fail(self):
     heat_collect = heat.Collector(
         keystoneclient=FakeFailKeystoneClient(self),
         heatclient=FakeHeatClient(self),
         discover_class=FakeKeystoneDiscover)
     self.assertRaises(exc.HeatMetadataNotAvailable, heat_collect.collect)
     self.assertIn('Forbidden', self.log.output)
 def test_collect_heat_fail(self, mock_url_for, mock___init__):
     mock___init__.return_value = None
     mock_url_for.return_value = cfg.CONF.heat.auth_url
     heat_collect = heat.Collector(
         keystoneclient=FakeFailKeystoneClient(self),
         heatclient=FakeHeatClient(self))
     self.assertRaises(exc.HeatMetadataNotAvailable, heat_collect.collect)
     self.assertIn('Forbidden', self.log.output)
示例#3
0
 def test_collect_heat(self):
     heat_md = heat.Collector(
         keystoneclient=FakeKeystoneClient(self),
         heatclient=FakeHeatClientSoftwareConfig(self),
         discover_class=FakeKeystoneDiscover).collect()
     self.assertThat(heat_md, matchers.IsInstance(list))
     self.assertEqual(2, len(heat_md))
     self.assertEqual('heat', heat_md[0][0])
     self.assertEqual(SOFTWARE_CONFIG_DATA['deployments'],
                      heat_md[0][1]['deployments'])
     self.assertEqual(('dep-name1', {'config1': 'value1'}), heat_md[1])
 def test_collect_heat(self, mock_url_for, mock___init__):
     mock___init__.return_value = None
     mock_url_for.return_value = cfg.CONF.heat.auth_url
     heat_md = heat.Collector(
         keystoneclient=FakeKeystoneClient(self),
         heatclient=FakeHeatClientSoftwareConfig(self)).collect()
     self.assertThat(heat_md, matchers.IsInstance(list))
     self.assertEqual(2, len(heat_md))
     self.assertEqual('heat', heat_md[0][0])
     self.assertEqual(SOFTWARE_CONFIG_DATA['deployments'],
                      heat_md[0][1]['deployments'])
     self.assertEqual(('dep-name1', {'config1': 'value1'}), heat_md[1])
示例#5
0
    def test_collect_heat(self):
        heat_md = heat.Collector(
            keystoneclient=FakeKeystoneClient(self),
            heatclient=FakeHeatClient(self),
            discover_class=FakeKeystoneDiscover).collect()
        self.assertThat(heat_md, matchers.IsInstance(list))
        self.assertEqual('heat', heat_md[0][0])
        heat_md = heat_md[0][1]

        for k in ('int1', 'strfoo', 'map_ab'):
            self.assertIn(k, heat_md)
            self.assertEqual(heat_md[k], META_DATA[k])

        # FIXME(yanyanhu): Temporary hack to deal with possible log
        # level setting for urllib3.connectionpool.
        self.assertTrue(self.log.output == '' or self.log.output
                        == 'Starting new HTTP connection (1): 192.0.2.1\n')
    def test_collect_heat(self, mock_url_for, mock___init__):
        mock___init__.return_value = None
        mock_url_for.return_value = cfg.CONF.heat.auth_url
        heat_md = heat.Collector(keystoneclient=FakeKeystoneClient(self),
                                 heatclient=FakeHeatClient(self)).collect()
        self.assertThat(heat_md, matchers.IsInstance(list))
        self.assertEqual('heat', heat_md[0][0])
        heat_md = heat_md[0][1]

        for k in ('int1', 'strfoo', 'map_ab'):
            self.assertIn(k, heat_md)
            self.assertEqual(heat_md[k], META_DATA[k])

        # FIXME(yanyanhu): Temporary hack to deal with possible log
        # level setting for urllib3.connectionpool.
        self.assertTrue(self.log.output == '' or self.log.output
                        == 'Starting new HTTP connection (1): 127.0.0.1\n')
示例#7
0
 def test_collect_heat_no_resource_name(self):
     cfg.CONF.heat.resource_name = None
     heat_collect = heat.Collector()
     self.assertRaises(exc.HeatMetadataNotConfigured, heat_collect.collect)
     self.assertIn('No resource_name configured', self.log.output)
示例#8
0
 def test_collect_heat_no_stack_id(self):
     cfg.CONF.heat.stack_id = None
     heat_collect = heat.Collector()
     self.assertRaises(exc.HeatMetadataNotConfigured, heat_collect.collect)
     self.assertIn('No stack_id configured', self.log.output)
示例#9
0
 def test_collect_heat_no_auth_url(self):
     cfg.CONF.heat.auth_url = None
     heat_collect = heat.Collector()
     self.assertRaises(exc.HeatMetadataNotConfigured, heat_collect.collect)
     self.assertIn('No auth_url configured', self.log.output)