Пример #1
0
 def test_collect_all_no_change_softwareconfig(self):
     soft_config_map = {
         'ec2': {'requests_impl': test_ec2.FakeRequests},
         'cfn': {
             'requests_impl': test_cfn.FakeRequestsSoftwareConfig(self)},
         'heat': {
             'keystoneclient': test_heat.FakeKeystoneClient(self),
             'heatclient': test_heat.FakeHeatClient(self)
         },
         'request': {'requests_impl': test_request.FakeRequests},
         'zaqar': {
             'keystoneclient': test_zaqar.FakeKeystoneClient(self),
             'zaqarclient': test_zaqar.FakeZaqarClient(self)
         },
     }
     (changed_keys, paths) = self._call_collect_all(
         store=True, collector_kwargs_map=soft_config_map)
     expected_changed = set(cfg.CONF.collectors)
     expected_changed.add('dep-name1')
     expected_changed.add('dep-name2')
     expected_changed.add('dep-name3')
     self.assertEqual(expected_changed, changed_keys)
     # Commit
     for changed in changed_keys:
         cache.commit(changed)
     (changed_keys, paths2) = self._call_collect_all(
         store=True, collector_kwargs_map=soft_config_map)
     self.assertEqual(set(), changed_keys)
     self.assertEqual(paths, paths2)
Пример #2
0
 def test_collect_all_store_softwareconfig(self):
     soft_config_map = {
         'ec2': {
             'requests_impl': test_ec2.FakeRequests
         },
         'cfn': {
             'requests_impl': test_cfn.FakeRequestsSoftwareConfig(self)
         },
         'heat': {
             'keystoneclient': test_heat.FakeKeystoneClient(self),
             'heatclient': test_heat.FakeHeatClient(self),
             'discover_class': test_heat.FakeKeystoneDiscover
         },
         'request': {
             'requests_impl': test_request.FakeRequests
         },
         'zaqar': {
             'keystoneclient': test_zaqar.FakeKeystoneClient(self),
             'zaqarclient': test_zaqar.FakeZaqarClient(self),
             'discover_class': test_heat.FakeKeystoneDiscover
         },
     }
     expected_changed = set(
         ('heat_local', 'ec2', 'cfn', 'heat', 'local', 'request',
          'dep-name1', 'dep-name2', 'dep-name3', 'zaqar'))
     self._test_collect_all_store(collector_kwargs_map=soft_config_map,
                                  expected_changed=expected_changed)
Пример #3
0
    def test_collect_all_no_change_softwareconfig(self):
        soft_config_map = {
            'ec2': {
                'requests_impl': test_ec2.FakeRequests
            },
            'gcore': {
                'client': test_gcore.GcoreTestHeatResourceClient.from_conf()
            },
            'cfn': {
                'requests_impl': test_cfn.FakeRequestsSoftwareConfig(self)
            },
            'heat': {
                'keystoneclient': test_heat.FakeKeystoneClient(self),
                'heatclient': test_heat.FakeHeatClient(self),
                'discover_class': test_heat.FakeKeystoneDiscover
            },
            'request': {
                'requests_impl': test_request.FakeRequests
            },
            'zaqar': {
                'keystoneclient': test_zaqar.FakeKeystoneClient(self),
                'zaqarclient': test_zaqar.FakeZaqarClient(self),
                'discover_class': test_heat.FakeKeystoneDiscover
            },
        }
        (changed_keys,
         paths) = self._call_collect_all(store=True,
                                         collector_kwargs_map=soft_config_map)
        expected_changed = set(cfg.CONF.collectors)
        expected_changed.add('dep-name1')
        expected_changed.add('dep-name2')
        expected_changed.add('dep-name3')
        self.assertEqual(expected_changed, changed_keys)
        # Commit
        for changed in changed_keys:
            cache.commit(changed)

        # Replace the ec2 requests with a failing one to simulate a transient
        # network failure
        soft_config_map['ec2'] = {'requests_impl': test_ec2.FakeFailRequests}
        (changed_keys,
         paths2) = self._call_collect_all(store=True,
                                          collector_kwargs_map=soft_config_map)
        self.assertEqual(set(), changed_keys)

        # check the second collect includes cached ec2 data despite network
        # failure
        self.assertEqual(paths, paths2)