From 181c52abb48efb318d58c2f6be5d5b6cb9c52f21 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Tue, 8 Apr 2025 15:34:07 +0300 Subject: [PATCH] Fix JDK matrix pipeline after configurable it split (#17461) PR #17219 introduced configurable split quantities for IT tests, which resulted in broken JDK matrix pipelines (e.g. as seen via the elastic internal link: https://buildkite.com/elastic/logstash-linux-jdk-matrix-pipeline/builds/444 reporting the following error ``` File "/buildkite/builds/bk-agent-prod-k8s-1743469287077752648/elastic/logstash-linux-jdk-matrix-pipeline/.buildkite/scripts/jdk-matrix-tests/generate-steps.py", line 263 def integration_tests(self, part: int, parts: int) -> JobRetValues: ^^^ SyntaxError: invalid syntax There was a problem rendering the pipeline steps. Exiting now. ``` ) This commit fixes the above problem, which was already fixed in #17642, using a more idiomatic way. Co-authored-by: Andrea Selva (cherry picked from commit b9469e0726da2d7e34d3ef8b54514b1948778dbe) --- .buildkite/scripts/jdk-matrix-tests/generate-steps.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/jdk-matrix-tests/generate-steps.py b/.buildkite/scripts/jdk-matrix-tests/generate-steps.py index c40b871c246..cbb4900354b 100644 --- a/.buildkite/scripts/jdk-matrix-tests/generate-steps.py +++ b/.buildkite/scripts/jdk-matrix-tests/generate-steps.py @@ -4,6 +4,7 @@ import os import sys import typing +from functools import partial from ruamel.yaml import YAML from ruamel.yaml.scalarstring import LiteralScalarString @@ -257,8 +258,8 @@ def ruby_unit_test(self) -> JobRetValues: retry=copy.deepcopy(ENABLED_RETRIES), ) - def integration_test_parts(self, parts) -> list[JobRetValues]: - return list(map(lambda idx: integration_tests(self, idx+1, parts), range(parts))) + def integration_test_parts(self, parts) -> list[partial[JobRetValues]]: + return [partial(self.integration_tests, part=idx+1, parts=parts) for idx in range(parts)] def integration_tests(self, part: int, parts: int) -> JobRetValues: step_name_human = f"Integration Tests - {part}/{parts}" @@ -276,8 +277,8 @@ def integration_tests(self, part: int, parts: int) -> JobRetValues: retry=copy.deepcopy(ENABLED_RETRIES), ) - def pq_integration_test_parts(self, parts) -> list[JobRetValues]: - return list(map(lambda idx: pq_integration_tests(self, idx+1, parts), range(parts))) + def pq_integration_test_parts(self, parts) -> list[partial[JobRetValues]]: + return [partial(self.pq_integration_tests, part=idx+1, parts=parts) for idx in range(parts)] def pq_integration_tests(self, part: int, parts: int) -> JobRetValues: step_name_human = f"IT Persistent Queues - {part}/{parts}"