Skip to content
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

YAML Tests: Download branch when in a release branch #2468

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ steps:
env:
RUBY_VERSION: "3.3"
STACK_VERSION: 8.15.0-SNAPSHOT
ES_YAML_TESTS_BRANCH: 8.15
TRANSPORT_VERSION: "8.3"
RUBY_SOURCE: "ruby"
TEST_SUITE: "platinum"
Expand Down
1 change: 1 addition & 0 deletions .buildkite/run-yaml-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ docker run \
--env "BUILDKITE=true" \
--env "TRANSPORT_VERSION=${TRANSPORT_VERSION}" \
--env "STACK_VERSION=${STACK_VERSION}" \
--env "ES_YAML_TESTS_BRANCH=${ES_YAML_TESTS_BRANCH}" \
--volume $repo:/usr/src/app \
--name elasticsearch-ruby \
--rm \
Expand Down
6 changes: 4 additions & 2 deletions elasticsearch-api/spec/yaml-test-runner/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@
CLIENT = Elasticsearch::Client.new(host: host, transport_options: transport_options)
end


tests_path = File.expand_path('./tmp', __dir__)

logger = Logger.new($stdout)
logger.level = Logger::WARN unless ENV['DEBUG']

Elasticsearch::Tests::Downloader::run(tests_path)
# If we're running in a release branch, download the corresponding branch for tests
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
branch = current_branch.match(/[0-9]\.[0-9]+/)&.[](0) || ENV['ES_YAML_TESTS_BRANCH'] || nil
Elasticsearch::Tests::Downloader::run(tests_path, branch)
Elasticsearch::Tests::TestRunner.new(CLIENT, tests_path, logger).run
6 changes: 6 additions & 0 deletions rake_tasks/automation.rake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ namespace :automation do
regexp = Regexp.new(/([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}?+(-SNAPSHOT)?)/)
files.each do |file|
content = File.read(file)
if file == '.buildkite/pipeline.yml'
branch = version.match(/([0-9]+\.[0-9]+)\.[0-9]+.*/)[1]
old_branch = content.match(/ES_YAML_TESTS_BRANCH: ([0-9.]+)/)[1]
content.gsub!(old_branch, branch)
puts "[#{old_branch}] -> [#{branch}] in #{file.gsub('./', '')}"
end
match = content.match(regexp)
next if match.nil?

Expand Down