docstr: Apply a config with apps that don't match the live apps.
  
  Serve should treat this like applying the first config. Its scaling
  direction should not be based on the previous config's target_capacity.
docstr_tok: ["Apply","a","config","with","apps","that","do","n't","match","the","live","apps",".","Serve","should","treat","this","like","applying","the","first","config",".","Its","scaling","direction","should","not","be","based","on","the","previous","config","'s","target_capacity","."]
code: def test_config_live_apps_mismatch(
      self, curr_target_capacity, curr_direction
  ):
      """Apply a config with apps that don't match the live apps.
  
      Serve should treat this like applying the first config. Its scaling
      direction should not be based on the previous config's target_capacity.
      """
  
      if curr_target_capacity is None:
          # When target_capacity is None, the current direction must be None.
          curr_direction = None
  
      curr_config = ServeDeploySchema(
          target_capacity=curr_target_capacity,
          applications=[
              create_app_config(name="app1"),
              create_app_config(name="app2"),
              create_app_config(name="app3"),
          ],
      )
  
      # Case 1: target_capacity is set. Serve should transition to scaling up.
      new_config = ServeDeploySchema(
          target_capacity=30,
          applications=[
              create_app_config(name="new_app1"),
              create_app_config(name="app2"),
          ],
      )
  
      assert (
          calculate_target_capacity_direction(
              curr_config,
              new_config,
              curr_direction,
          )
          is TargetCapacityDirection.UP
      )
  
      # Case 2: target_capacity is not set. Serve should not be scaling.
      new_config = ServeDeploySchema(
          target_capacity=None,
          applications=[
              create_app_config(name="new_app1"),
              create_app_config(name="app2"),
          ],
      )
  
      assert (
          calculate_target_capacity_direction(
              curr_config,
              new_config,
              curr_direction,
          )
          is None
      )
  
file_path: ray/python/ray/serve/tests/unit/test_controller.py
imports: from copy import deepcopy
  import pytest
  from ray.serve._private.common import TargetCapacityDirection
  from ray.serve._private.controller import applications_match, calculate_target_capacity_direction
  from ray.serve.schema import HTTPOptionsSchema, ServeApplicationSchema, ServeDeploySchema
label_desc: Use image node_id 6 for calling the TestCalculateScaleDirection obj's underlying member method code with example usage: obj.test_config_live_apps_mismatch(curr_target_capacity, curr_direction) without return types