Example #1
0
    def test_update_host_availability_zone_cache(self):
        """Test availability zone cache could be update."""
        service = self._create_service_with_topic('compute', self.host)

        # Create a new aggregate with an AZ and add the host to the AZ
        az_name = 'az1'
        cache_key = az._make_cache_key(self.host)
        agg_az1 = self._create_az('agg-az1', az_name)
        self._add_to_aggregate(service, agg_az1)
        az.update_host_availability_zone_cache(self.context, self.host)
        self.assertEqual('az1', az._get_cache().get(cache_key))
        az.update_host_availability_zone_cache(self.context, self.host, 'az2')
        self.assertEqual('az2', az._get_cache().get(cache_key))
Example #2
0
 def test_rest_availability_zone_reset_cache(self):
     az.reset_cache()
     self.assertEqual(az._get_cache().get("cache"), None)
Example #3
0
 def test_rest_availability_zone_reset_cache(self):
     az._get_cache().add('cache', 'fake_value')
     az.reset_cache()
     self.assertIsNone(az._get_cache().get('cache'))
 def test_rest_availability_zone_reset_cache(self):
     az._get_cache().add("cache", "fake_value")
     az.reset_cache()
     self.assertIsNone(az._get_cache().get("cache"))