From 2e7a3cd41ee464d3a939e07188d8cec077510626 Mon Sep 17 00:00:00 2001 From: Dimitrios Liappis Date: Thu, 1 Feb 2024 10:37:41 +0200 Subject: [PATCH 1/2] Split java/ruby unit test steps on Windows As a follow up to #15861 this commit splits the current unit tests step for the Windows JDK matrix pipeline to two that run Java and Ruby unit tests separately. Closes https://github.com/elastic/logstash/issues/15566 --- .../jdk-matrix-tests/generate-steps.py | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.buildkite/scripts/jdk-matrix-tests/generate-steps.py b/.buildkite/scripts/jdk-matrix-tests/generate-steps.py index 2f9fd7e9f23..681272b85bb 100644 --- a/.buildkite/scripts/jdk-matrix-tests/generate-steps.py +++ b/.buildkite/scripts/jdk-matrix-tests/generate-steps.py @@ -135,13 +135,30 @@ def __init__(self, os: str, jdk: str, group_key: str, agent: typing.Union[GCPAge def all_jobs(self) -> list[typing.Callable[[], JobRetValues]]: return [ self.init_annotation, - self.unit_tests, + self.java_unit_test, + self.ruby_unit_test, ] - def unit_tests(self) -> JobRetValues: - step_name_human = "Unit Test (Java/Ruby)" - step_key = f"{self.group_key}-unit-test" - test_command = rf'''.\\.buildkite\\scripts\\jdk-matrix-tests\\launch-command.ps1 -JDK "{self.jdk}" -StepNameHuman "{step_name_human}" -AnnotateContext "{self.group_key}" -CIScript ".\\ci\\unit_tests.ps1" -Annotate + def java_unit_test(self) -> JobRetValues: + step_name_human = "Java Unit Test" + step_key = f"{self.group_key}-java-unit-test" + test_command = rf'''.\\.buildkite\\scripts\\jdk-matrix-tests\\launch-command.ps1 -JDK "{self.jdk}" -StepNameHuman "{step_name_human}" -AnnotateContext "{self.group_key}" -CIScript ".\\ci\\unit_tests.ps1 java" -Annotate + ''' + + return JobRetValues( + step_label=step_name_human, + command=LiteralScalarString(test_command), + step_key=step_key, + depends=self.init_annotation_key, + artifact_paths=["build_reports.zip"], + agent=self.agent.to_dict(), + retry=copy.deepcopy(ENABLED_RETRIES), + ) + + def ruby_unit_test(self) -> JobRetValues: + step_name_human = "Ruby Unit Test" + step_key = f"{self.group_key}-ruby-unit-test" + test_command = rf'''.\\.buildkite\\scripts\\jdk-matrix-tests\\launch-command.ps1 -JDK "{self.jdk}" -StepNameHuman "{step_name_human}" -AnnotateContext "{self.group_key}" -CIScript ".\\ci\\unit_tests.ps1 ruby" -Annotate ''' return JobRetValues( From e475bb33eb02263cc0e5d97412297f72d1431a7e Mon Sep 17 00:00:00 2001 From: Mashhur Date: Fri, 23 Feb 2024 14:10:15 -0800 Subject: [PATCH 2/2] Fix the Bootstrap check test failure on Windows. --- x-pack/spec/config_management/bootstrap_check_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x-pack/spec/config_management/bootstrap_check_spec.rb b/x-pack/spec/config_management/bootstrap_check_spec.rb index 681b9bc6ace..27021e63690 100644 --- a/x-pack/spec/config_management/bootstrap_check_spec.rb +++ b/x-pack/spec/config_management/bootstrap_check_spec.rb @@ -119,7 +119,9 @@ end context 'when a configuration file exists in the specified location' do - let(:config_location) { Stud::Temporary.file.path } + # gsub replacement is only for Windows platform, without `gsub` `Dir.glob` cannot discover files and test fails + # note that in other `Dir.glob` places, we used `File.join/dirname` operations which doesn't create issue on Windows + let(:config_location) { Stud::Temporary.file.path.gsub("\\", "/") } it "raises a `LogStash::BootstrapCheckError` error" do expect { subject.check(settings) }.to raise_error LogStash::BootstrapCheckError