Skip to content

[8.16] tests: make integration split quantity configurable (backport #17219) #17370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 19, 2025

Release notes

[rn:skip]

What does this PR do?

Adds new optional positional parameter to ci/integration_tests.sh split, so that we can tell it how many partitions to split the tests into. When this parameter is missing, it is assumed to be 2 for backward-compatibility.

Why is it important/What is the impact to the user?

No user impact.

This allows us to configure a larger quantity of integration spec splits so that we can run more jobs in parallel.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

Observe the splits in CI:

1.Split 0 Running integration specs split[0] of 2: specs/01_logstash_bin_smoke_spec.rb specs/cli/http_proxy_install_spec.rb specs/cli/keystore_spec.rb specs/cli/prepare_offline_pack_spec.rb specs/command_line_spec.rb specs/direct_heap_allocator_flag_spec.rb specs/env_variables_condition_spec.rb specs/es_output_how_spec.rb specs/install_java_plugin_spec.rb specs/kafka_input_spec.rb specs/mixed_codec_spec.rb specs/multiple_pipeline_spec.rb specs/plugin_name_log_spec.rb specs/reserved_tags_field_spec.rb specs/settings_spec.rb specs/webserver_spec.rb
2.Split 1 Running integration specs split[1] of 2: specs/beats_input_spec.rb specs/cli/install_spec.rb specs/cli/list_spec.rb specs/cli/remove_spec.rb specs/deprecation_log_spec.rb specs/dlq_spec.rb specs/env_variables_config_spec.rb specs/fatal_error_spec.rb specs/java_api_spec.rb specs/logstash_to_logstash_spec.rb specs/monitoring_api_spec.rb specs/pipeline_log_spec.rb specs/reload_config_spec.rb specs/secret_store_spec.rb specs/slowlog_spec.rb

OR:

  1. echo the ./gradlew command instead of invoking it:
diff --git a/ci/integration_tests.sh b/ci/integration_tests.sh
index a6014ca89..fe28cbdc8 100755
--- a/ci/integration_tests.sh
+++ b/ci/integration_tests.sh
@@ -45,7 +45,7 @@ elif [[ $1 == "split" ]]; then
     done
 
     echo "Running integration specs split[${selected_partition}] of ${partition_count}: ${partition_specs[*]}"
-    ./gradlew runIntegrationTests -PrubyIntegrationSpecs="${partition_specs[*]}" --console=plain
+    echo ./gradlew runIntegrationTests -PrubyIntegrationSpecs="${partition_specs[*]}" --console=plain
 
 elif [[ !  -z  $@  ]]; then
     echo "Running integration tests 'rspec $@'"
  1. Invoke splits to observe that all spec files are accounted for:
    ci/integration_tests.sh split 0 3
    ci/integration_tests.sh split 1 3
    ci/integration_tests.sh split 2 3
    
    ci/integration_tests.sh split 0 4
    ci/integration_tests.sh split 1 4
    ci/integration_tests.sh split 2 4
    ci/integration_tests.sh split 3 4
    ~~~<hr>This is an automatic backport of pull request #17219 done by [Mergify](https://mergify.com).
    

* tests: make integration split quantity configurable

Refactors shared splitter bash function to take a list of files on stdin
and split into a configurable number of partitions, emitting only those from
the currently-selected partition to stdout.

Also refactors the only caller in the integration_tests launcher script to
accept an optional partition_count parameter (defaulting to `2` for backward-
compatibility), to provide the list of specs to the function's stdin, and to
output relevant information about the quantity of partition splits and which
was selected.

* ci: run integration tests in 3 parts

(cherry picked from commit 3e0f488)
@mergify mergify bot added the backport label Mar 19, 2025
@mergify mergify bot assigned yaauie Mar 19, 2025
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @yaauie

Copy link
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Clean and Green 🎉

@yaauie yaauie merged commit 9f74290 into 8.16 Mar 20, 2025
7 checks passed
@yaauie yaauie deleted the mergify/bp/8.16/pr-17219 branch March 20, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants