def METHOD_NAME(get_configuration, configure_environment, reset_ossec_log, publish_messages,
                      daemons_handler_module, wait_for_gcp_start):
    '''
    description: Check if the 'gcp-pubsub' module pulls a message number less than or equal to the limit set
                 in the 'max_messages' tag. For this purpose, the test will use a fixed limit and generate a
                 number of GCP events lower and upper than the limit (depending on the test case). Then, it
                 will wait for the 'fetching' event, and finally, the test will verify that, if the message
                 number exceeds that limit, the module will only pull messages up to the limit, and the rest
                 will be pulled in successive iterations, and if not, the module will pull all messages in
                 the same operation.
    wazuh_min_version: 4.2.0
    tier: 0
    parameters:
        - get_configuration:
            type: fixture
            brief: Get configurations from the module.
        - configure_environment:
            type: fixture
            brief: Configure a custom environment for testing.
        - publish_messages:
            type: list
            brief: List of testing GCP logs.
        - restart_wazuh:
            type: fixture
            brief: Reset the 'ossec.log' file and start a new monitor.
        - wait_for_gcp_start:
            type: fixture
            brief: Wait for the 'gpc-pubsub' module to start.
    assertions:
        - Verify that the 'gcp-pubsub' module pulls all GCP messages in one operation if
          the number of them does not exceed the limit set in the 'max_messages' tag.
        - Verify that the 'gcp-pubsub' module pulls GCP messages up to the limit set
          in the 'max_messages' tag when the number of them exceeds that limit, and
          the remaining ones are pulled in the successive operations.
    input_description: A test case (ossec_conf) is contained in an external YAML file (wazuh_conf.yaml)
                       which includes configuration settings for the 'gcp-pubsub' module. That is
                       combined with the message limit defined in the module. The GCP access
                       credentials can be found in the 'configuration_template.yaml' file.
    expected_output:
        - r'wm_gcp_main(): DEBUG.* Starting fetching of logs.'
        - r'.*wm_gcp_run.*: INFO.* INFO: Received and acknowledged .* messages'
    tags:
        - logs
        - scheduled
    '''
    count_message = 0
    str_interval = get_configuration['sections'][0]['elements'][4]['interval']['value']
    time_interval = int(''.join(filter(str.isdigit, str_interval)))
    # Wait till the fetch starts
    wazuh_log_monitor.start(timeout=global_parameters.default_timeout + time_interval,
                            callback=callback_detect_start_fetching_logs,
                            error_message='Did not receive expected '
                                          '"Starting fetching of logs" event')
    numbers_pulled = wazuh_log_monitor.start(timeout=pull_messages_timeout,
                                             callback=callback_received_messages_number,
                                             error_message='Did not receive expected '
                                                           '- INFO - Received and acknowledged x messages').result()
    # Validate that the number pulled is at least once greater or equal than the published messages
    # and less than the maximum number of messages extracted allowed in each iteration
    if publish_messages <= max_messages:
        # GCP might log messages from sources other than ourselves
        for number_pulled in numbers_pulled:
            if int(number_pulled) != 0:
                if (int(number_pulled) >= publish_messages):
                    # A counter is used to prevent it from failing due to logs from other sources
                    count_message += 1
                assert int(number_pulled) <= max_messages
        assert count_message >= 1
    else:
        # Validate that the number pulled always is less than the maximum messages pulled allowed in each iteration
        for number_pulled in numbers_pulled:
            assert int(number_pulled) <= max_messages