def test_set_availability_zone_compute_service(self):
        service = self._create_service_with_topic('compute', self.host)
        services = db.service_get_all(self.context)

        # The service is not add into aggregate, so confirm it is default
        # availability zone.
        new_service = az.set_availability_zones(self.context, services)[0]
        self.assertEqual(self.default_az, new_service['availability_zone'])

        # The service is added into aggregate, confirm return the aggregate
        # availability zone.
        self._add_to_aggregate(service, self.agg)
        new_service = az.set_availability_zones(self.context, services)[0]
        self.assertEqual(self.availability_zone,
                         new_service['availability_zone'])

        self._destroy_service(service)
Test for compute service get right availability zone.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/test_availability_zones.py/AvailabilityZoneTestCases.test_set_availability_zone_compute_service