code: def test_cloudwatch_agent_update_with_change_head_node(
      ec2_client_stub, ssm_client_stub
  ):
      # create test cluster head node ID and an associated cloudwatch helper
      node_id = "i-abc"
      is_head_node = True
      cloudwatch_helper = helpers.get_cloudwatch_helper(node_id)
  
      # given a directive to check for the Unified CloudWatch Agent status...
      # expect CloudWatch Agent is installed
      stubs.get_ec2_cwa_installed_tag_true(ec2_client_stub, node_id)
      # given a directive to update a cluster CloudWatch Agent Config with new
      # changes...
      # expect the stored the CloudWatch Agent Config is different from local
      # config
      cw_ssm_param_name = helpers.get_ssm_param_name(
          cloudwatch_helper.cluster_name, "agent"
      )
      stubs.get_param_ssm_different(ssm_client_stub, cw_ssm_param_name)
  
      # given an updated CloudWatch Agent Config file...
      # expect to store the new CloudWatch Agent config as an SSM parameter
      cmd_id = stubs.put_parameter_cloudwatch_config(
          ssm_client_stub, cloudwatch_helper.cluster_name, "agent"
      )
  
      # given an updated CloudWatch Agent Config file...
      # expect to update the node tag equal to updated config file sha1 hash
      # to reflect the changes in config file
      stubs.update_hash_tag_success(
          ec2_client_stub, node_id, "agent", cloudwatch_helper
      )
      # given that updated CloudWatch Agent Config is put to Parameter Store...
      # expect to send an SSM command to restart CloudWatch Agent on all nodes
      cmd_id = stubs.send_command_stop_cwa(ssm_client_stub, node_id)
      # given a SSM command to stop CloudWatch Agent sent to all nodes...
      # expect to wait for the command to complete successfully on every node
      stubs.list_command_invocations_success(
          ssm_client_stub, node_id, cmd_id
      )
      cmd_id = stubs.send_command_start_cwa(
          ssm_client_stub, node_id, cw_ssm_param_name
      )
      # given a SSM command to start CloudWatch Agent sent to all nodes...
      # expect to wait for the command to complete successfully on every node
      stubs.list_command_invocations_success(
          ssm_client_stub, node_id, cmd_id
      )
  
      # given our mocks and the example CloudWatch Agent config as input...
      # expect CloudWatch Agent configured to use updated file on each cluster
      # node successfully
      cloudwatch_helper._update_cloudwatch_config("agent", is_head_node)
  
      # expect no pending responses left in client stub queues
      ec2_client_stub.assert_no_pending_responses()
      ssm_client_stub.assert_no_pending_responses()
  
imports: import copy
  from unittest.mock import Mock, patch
  import pytest
  from click.exceptions import ClickException
  import ray.tests.aws.utils.helpers
  import ray.tests.aws.utils.stubs
  from ray.autoscaler._private.aws.config import DEFAULT_AMI, _configure_subnet, _get_subnets_or_die, bootstrap_aws, log_to_cli
  from ray.autoscaler._private.aws.node_provider import AWSNodeProvider
  from ray.autoscaler._private.providers import _get_node_provider
  from ray.tests.aws.utils.constants import AUX_SG, AUX_SUBNET, CUSTOM_IN_BOUND_RULES, DEFAULT_CLUSTER_NAME, DEFAULT_INSTANCE_PROFILE, DEFAULT_KEY_PAIR, DEFAULT_LT, DEFAULT_SG, DEFAULT_SG_AUX_SUBNET, DEFAULT_SG_DUAL_GROUP_RULES, DEFAULT_SG_WITH_NAME, DEFAULT_SG_WITH_NAME_AND_RULES, DEFAULT_SG_WITH_RULES, DEFAULT_SG_WITH_RULES_AUX_SUBNET, DEFAULT_SUBNET
label_desc: Use image node_id 20 for calling a global function with example usage: test_cloudwatch_agent_update_with_change_head_node(ec2_client_stub, ssm_client_stub) without return types