From c3696e7cb55141d4ad97bc3157b73ab6c070dc37 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Fri, 26 Apr 2024 16:56:32 +0200 Subject: [PATCH 01/11] Check if safe_load is defined on YAML before using it --- lib/elastic_apm/config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elastic_apm/config.rb b/lib/elastic_apm/config.rb index 0566936cd..275653cd3 100644 --- a/lib/elastic_apm/config.rb +++ b/lib/elastic_apm/config.rb @@ -256,7 +256,7 @@ def load_config_file read = File.read(config_file) evaled = ERB.new(read).result - YAML.safe_load(evaled) + YAML.method_defined?(:safe_load) ? YAML.safe_load(evaled) : YAML.load(evaled) end def load_env From 6a1c67eeaa8861f2808513cc3e82c7ce15302233 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Fri, 26 Apr 2024 17:15:21 +0200 Subject: [PATCH 02/11] Add Syck to Gemfile --- Gemfile | 1 + spec/integration/syck_spec.rb | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 spec/integration/syck_spec.rb diff --git a/Gemfile b/Gemfile index 19f70996a..2fe7d0d6a 100644 --- a/Gemfile +++ b/Gemfile @@ -64,6 +64,7 @@ gem 'sidekiq', require: nil gem 'simplecov', require: false gem 'simplecov-cobertura', require: false gem 'sucker_punch', '~> 2.0', require: nil +gem 'syck', require: nil gem 'yard', require: nil gem 'yarjuf' diff --git a/spec/integration/syck_spec.rb b/spec/integration/syck_spec.rb new file mode 100644 index 000000000..b00270d96 --- /dev/null +++ b/spec/integration/syck_spec.rb @@ -0,0 +1,29 @@ +# Licensed to Elasticsearch B.V. under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch B.V. licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# frozen_string_literal: true + +require 'integration_helper' +require 'syck' + +RSpec.describe 'Syck YAML' do + + it 'loads from config file' do + config = ElasticAPM::Config.new(config_file: 'spec/fixtures/elastic_apm.yml') + expect(config.server_url).to eq 'somewhere-config.com' + end +end From b601318229f5dfc6053de7a7c3c05024fc74df39 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Fri, 26 Apr 2024 17:29:55 +0200 Subject: [PATCH 03/11] Don't test Syck with JRuby --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 2fe7d0d6a..609e36ae0 100644 --- a/Gemfile +++ b/Gemfile @@ -64,7 +64,7 @@ gem 'sidekiq', require: nil gem 'simplecov', require: false gem 'simplecov-cobertura', require: false gem 'sucker_punch', '~> 2.0', require: nil -gem 'syck', require: nil +gem 'syck', require: nil if !defined?(JRUBY_VERSION) gem 'yard', require: nil gem 'yarjuf' From 885063f340251adaa2c50b609dec5983c8dacc79 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Fri, 26 Apr 2024 17:40:11 +0200 Subject: [PATCH 04/11] sorting sqlite3 versioning --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 609e36ae0..460a808b2 100644 --- a/Gemfile +++ b/Gemfile @@ -126,10 +126,10 @@ if RUBY_PLATFORM == 'java' end elsif frameworks_versions['rails'] =~ /^(4|5)/ gem 'sqlite3', '~> 1.3.6' -elsif RUBY_VERSION < '2.7' +elsif RUBY_VERSION <= '2.7' gem 'sqlite3', '~> 1.4.4' else - gem 'sqlite3' + gem 'sqlite3', '~> 2' end # sneakers main only supports >=2.5.0 From 8eb65a69c45425852f339b50457e2c66b98a6381 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Fri, 26 Apr 2024 17:55:54 +0200 Subject: [PATCH 05/11] undo Gemfile changes --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 460a808b2..609e36ae0 100644 --- a/Gemfile +++ b/Gemfile @@ -126,10 +126,10 @@ if RUBY_PLATFORM == 'java' end elsif frameworks_versions['rails'] =~ /^(4|5)/ gem 'sqlite3', '~> 1.3.6' -elsif RUBY_VERSION <= '2.7' +elsif RUBY_VERSION < '2.7' gem 'sqlite3', '~> 1.4.4' else - gem 'sqlite3', '~> 2' + gem 'sqlite3' end # sneakers main only supports >=2.5.0 From d82c366b762b5adc4587ef4ad36c435c60be2c0f Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Mon, 29 Apr 2024 14:49:38 +0200 Subject: [PATCH 06/11] Fix logic for testing Syck on JRuby --- spec/integration/syck_spec.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/spec/integration/syck_spec.rb b/spec/integration/syck_spec.rb index b00270d96..2110b0d26 100644 --- a/spec/integration/syck_spec.rb +++ b/spec/integration/syck_spec.rb @@ -17,13 +17,15 @@ # frozen_string_literal: true -require 'integration_helper' -require 'syck' +if !defined?(JRUBY_VERSION) + require 'integration_helper' + require 'syck' -RSpec.describe 'Syck YAML' do + RSpec.describe 'Syck YAML' do - it 'loads from config file' do - config = ElasticAPM::Config.new(config_file: 'spec/fixtures/elastic_apm.yml') - expect(config.server_url).to eq 'somewhere-config.com' + it 'loads from config file' do + config = ElasticAPM::Config.new(config_file: 'spec/fixtures/elastic_apm.yml') + expect(config.server_url).to eq 'somewhere-config.com' + end end end From a6bd775a1fbfc2f8b89aa2e65cf14e91706c1c9f Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Mon, 29 Apr 2024 14:56:18 +0200 Subject: [PATCH 07/11] Try running bundle update before tests --- bin/setup | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/setup b/bin/setup index dce67d860..f6776b6dc 100755 --- a/bin/setup +++ b/bin/setup @@ -4,5 +4,6 @@ IFS=$'\n\t' set -vx bundle install +bundle update # Do any other automated setup that you need to do here From ff75223c3c776d17056972180ed74c35b0295686 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Mon, 29 Apr 2024 15:03:36 +0200 Subject: [PATCH 08/11] revert bundle update --- bin/setup | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/setup b/bin/setup index f6776b6dc..dce67d860 100755 --- a/bin/setup +++ b/bin/setup @@ -4,6 +4,5 @@ IFS=$'\n\t' set -vx bundle install -bundle update # Do any other automated setup that you need to do here From 8c8902e74bdb24af17c632c7786cb7786f459fa7 Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Mon, 29 Apr 2024 15:04:16 +0200 Subject: [PATCH 09/11] install latest sqlite3 --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 609e36ae0..0884a345d 100644 --- a/Gemfile +++ b/Gemfile @@ -126,8 +126,8 @@ if RUBY_PLATFORM == 'java' end elsif frameworks_versions['rails'] =~ /^(4|5)/ gem 'sqlite3', '~> 1.3.6' -elsif RUBY_VERSION < '2.7' - gem 'sqlite3', '~> 1.4.4' +# elsif RUBY_VERSION < '2.7' +# gem 'sqlite3', '~> 1.4.4' else gem 'sqlite3' end From c7ed42c180d092963a4462e55754b021027b680d Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Mon, 29 Apr 2024 15:06:53 +0200 Subject: [PATCH 10/11] Pin sqlite3 version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0884a345d..f2ac95aa3 100644 --- a/Gemfile +++ b/Gemfile @@ -129,7 +129,7 @@ elsif frameworks_versions['rails'] =~ /^(4|5)/ # elsif RUBY_VERSION < '2.7' # gem 'sqlite3', '~> 1.4.4' else - gem 'sqlite3' + gem 'sqlite3', '~> 1.4.4' end # sneakers main only supports >=2.5.0 From 4c14755628128f45cac88516415056e759fdf44a Mon Sep 17 00:00:00 2001 From: Emily Stolfo Date: Mon, 29 Apr 2024 15:24:44 +0200 Subject: [PATCH 11/11] Stick with older version of sqlite3 --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index f2ac95aa3..1649bb593 100644 --- a/Gemfile +++ b/Gemfile @@ -126,8 +126,6 @@ if RUBY_PLATFORM == 'java' end elsif frameworks_versions['rails'] =~ /^(4|5)/ gem 'sqlite3', '~> 1.3.6' -# elsif RUBY_VERSION < '2.7' -# gem 'sqlite3', '~> 1.4.4' else gem 'sqlite3', '~> 1.4.4' end