code: def test_incremental_scale_up(
      shutdown_ray_and_serve, client: ServeControllerClient
  ):
      config = ServeDeploySchema(
          applications=[
              ServeApplicationSchema(
                  import_path="ray.serve.tests.test_target_capacity:test_app"
              )
          ]
      )
  
      # Initially deploy at target_capacity 0, should have no replicas.
      config.target_capacity = 0.0
      client.deploy_apps(config)
      wait_for_condition(lambda: serve.status().target_capacity == 0.0)
      wait_for_condition(
          check_expected_num_replicas,
          deployment_to_num_replicas={
              INGRESS_DEPLOYMENT_NAME: 0,
              DOWNSTREAM_DEPLOYMENT_NAME: 0,
          },
      )
  
      # Initially deploy at target_capacity 1, should have 1 replica of each.
      config.target_capacity = 1.0
      client.deploy_apps(config)
      wait_for_condition(lambda: serve.status().target_capacity == 1.0)
      wait_for_condition(
          check_expected_num_replicas,
          deployment_to_num_replicas={
              INGRESS_DEPLOYMENT_NAME: 1,
              DOWNSTREAM_DEPLOYMENT_NAME: 1,
          },
      )
  
      # Increase target_capacity to 50, ingress deployment should scale up.
      config.target_capacity = 50.0
      client.deploy_apps(config)
      wait_for_condition(lambda: serve.status().target_capacity == 50.0)
      wait_for_condition(
          check_expected_num_replicas,
          deployment_to_num_replicas={
              INGRESS_DEPLOYMENT_NAME: INGRESS_DEPLOYMENT_NUM_REPLICAS
              / 2,
              DOWNSTREAM_DEPLOYMENT_NAME: DOWNSTREAM_DEPLOYMENT_NUM_REPLICAS
              / 2,
          },
      )
  
      # Increase target_capacity to 100, both should fully scale up.
      config.target_capacity = 100.0
      client.deploy_apps(config)
      wait_for_condition(
          lambda: serve.status().target_capacity == 100.0
      )
      wait_for_condition(
          check_expected_num_replicas,
          deployment_to_num_replicas={
              INGRESS_DEPLOYMENT_NAME: INGRESS_DEPLOYMENT_NUM_REPLICAS,
              DOWNSTREAM_DEPLOYMENT_NAME: DOWNSTREAM_DEPLOYMENT_NUM_REPLICAS,
          },
      )
  
      # Finish rollout (remove target_capacity), should have no effect.
      config.target_capacity = None
      client.deploy_apps(config)
      wait_for_condition(lambda: serve.status().target_capacity is None)
      wait_for_condition(
          check_expected_num_replicas,
          deployment_to_num_replicas={
              INGRESS_DEPLOYMENT_NAME: INGRESS_DEPLOYMENT_NUM_REPLICAS,
              DOWNSTREAM_DEPLOYMENT_NAME: DOWNSTREAM_DEPLOYMENT_NUM_REPLICAS,
          },
      )
  
imports: import asyncio
  import sys
  from copy import deepcopy
  from typing import Dict, Optional
  import pytest
  import ray
  from ray import serve
  from ray._private.pydantic_compat import BaseModel
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.exceptions import RayActorError
  from ray.serve import Application
  from ray.serve._private.client import ServeControllerClient
  from ray.serve._private.common import ApplicationStatus, DeploymentStatus, DeploymentStatusTrigger, ReplicaState, TargetCapacityDirection
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE
  from ray.serve.config import AutoscalingConfig
  from ray.serve.context import _get_global_client
  from ray.serve.schema import ServeApplicationSchema, ServeDeploySchema
label_desc: Use image node_id 4 for calling a global function with example usage: test_incremental_scale_up(shutdown_ray_and_serve, client) without return types