@Override
    public Runnable provisionHosts(HostProvisionRequest request, Predicate<NodeResources> realHostResourcesWithinLimits, Consumer<List<ProvisionedHost>> whenProvisioned) throws NodeAllocationException {
        if (behaviour(Behaviour.failProvisionRequest)) throw new NodeAllocationException("No capacity for provision request", true);
        Flavor hostFlavor = hostFlavors.get(request.clusterType().orElse(ClusterSpec.Type.content));
        if (hostFlavor == null)
            hostFlavor = flavors.stream()
                                .filter(f -> request.sharing().isExclusiveAllocation() ? compatible(f, request.resources())
                                                                                       : satisfies(f, request.resources()))
                                .filter(f -> realHostResourcesWithinLimits.test(f.resources()))
                                .findFirst()
                                .orElseThrow(() -> new NodeAllocationException("No host flavor matches " + request.resources(), true));

        List<ProvisionedHost> hosts = new ArrayList<>();
        for (int index : request.indices()) {
            String hostHostname = request.type() == host ? "host" + index : request.type().name() + index;
            hosts.add(new ProvisionedHost("id-of-" + request.type().name() + index,
                                          hostHostname,
                                          hostFlavor,
                                          request.type(),
                                          request.sharing().isExclusiveAllocation() ? Optional.of(request.owner()) : Optional.empty(),
                                          Optional.empty(),
                                          createHostnames(request.type(), hostFlavor, index),
                                          request.resources(),
                                          request.osVersion(),
                                          request.cloudAccount()));
        }
        provisionedHosts.addAll(hosts);
        whenProvisioned.accept(hosts);
        return () -> {};
    }
Returns whether given behaviour is active for this invocation
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockHostProvisioner.java