def METHOD_NAME(logger, metrics, port_generator):
    connection_pool = _ConnectionPoolMap(
        runtime_name='deployment',
        logger=logger,
        metrics=metrics,
        histograms=_NetworkingHistograms(),
    )
    head_port = port_generator()
    head_address = f'0.0.0.0:{head_port}'
    head_deployment = 'head'
    connection_pool.add_head(
        deployment=head_deployment, address=head_address, head_id=0
    )
    assert connection_pool.get_replicas(
        deployment=head_deployment, head=True
    ).has_connections()
    assert not connection_pool.get_replicas_all_shards(deployment=head_deployment)
    replica_0_address = f'0.0.0.0:{port_generator()}'
    replica_0_deployment = 'replicas_0'
    connection_pool.add_replica(
        deployment=replica_0_deployment, address=replica_0_address, shard_id=0
    )
    replica_1_address = f'0.0.0.0:{port_generator()}'
    replica_1_deployment = 'replicas_1'
    connection_pool.add_replica(
        deployment=replica_1_deployment, address=replica_1_address, shard_id=0
    )
    assert connection_pool.get_replicas(
        deployment=replica_0_deployment, head=False
    ).has_connections()
    assert len(connection_pool.get_replicas_all_shards(deployment=replica_0_deployment))
    assert connection_pool.get_replicas(
        deployment=replica_1_deployment, head=False
    ).has_connections()
    assert len(connection_pool.get_replicas_all_shards(deployment=replica_1_deployment))