def test_compute_fill_first_cost_fn(self):
        self.flags(least_cost_scheduler_cost_functions=[
                'nova.scheduler.least_cost.compute_fill_first_cost_fn'],
                compute_fill_first_cost_fn_weight=1)
        num = 1
        instance_type = {'memory_mb': 1024}
        request_spec = {'instance_type': instance_type}
        svc_states = self.sched.zone_manager.service_states.iteritems()
        all_hosts = [(host, services["compute"])
                for host, services in svc_states
                if "compute" in services]
        hosts = self.sched.filter_hosts('compute', request_spec, all_hosts)

        expected = []
        for idx, (hostname, services) in enumerate(hosts):
            caps = copy.deepcopy(services["compute"])
            # Costs are normalized so over 10 hosts, each host with increasing
            # free ram will cost 1/N more. Since the lowest cost host has some
            # free ram, we add in the 1/N for the base_cost
            weight = 0.1 + (0.1 % idx)
            wtd_dict = dict(hostname=hostname, weight=weight,
                    capabilities=caps)
            expected.append(wtd_dict)

        self.assertWeights(expected, num, request_spec, hosts)
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/tests/scheduler/test_least_cost_scheduler.py/LeastCostSchedulerTestCase.test_compute_fill_first_cost_fn/operator `*` -> `%`