appsignal 3.0.18-java → 3.0.21-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +134 -0
  3. data/CHANGELOG.md +44 -0
  4. data/appsignal.gemspec +1 -0
  5. data/build_matrix.yml +8 -1
  6. data/ext/base.rb +3 -2
  7. data/gemfiles/rails-6.1.gemfile +7 -0
  8. data/gemfiles/rails-7.0.gemfile +1 -1
  9. data/lib/appsignal/cli/diagnose/utils.rb +0 -14
  10. data/lib/appsignal/cli/diagnose.rb +6 -5
  11. data/lib/appsignal/config.rb +54 -21
  12. data/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb +7 -18
  13. data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +24 -0
  14. data/lib/appsignal/system.rb +0 -4
  15. data/lib/appsignal/transaction.rb +2 -2
  16. data/lib/appsignal/version.rb +1 -1
  17. data/lib/appsignal.rb +0 -15
  18. data/spec/lib/appsignal/cli/diagnose_spec.rb +14 -11
  19. data/spec/lib/appsignal/config_spec.rb +138 -9
  20. data/spec/lib/appsignal/event_formatter/active_record/sql_formatter_spec.rb +2 -2
  21. data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +21 -47
  22. data/spec/lib/appsignal/event_formatter/sequel/sql_formatter_spec.rb +30 -0
  23. data/spec/lib/appsignal/hooks/activejob_spec.rb +2 -19
  24. data/spec/lib/appsignal/hooks/sequel_spec.rb +1 -1
  25. data/spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb +5 -1
  26. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +14 -5
  27. data/spec/lib/appsignal/transaction_spec.rb +2 -2
  28. data/spec/lib/appsignal/utils/query_params_sanitizer_spec.rb +2 -2
  29. data/spec/lib/appsignal_spec.rb +59 -38
  30. data/spec/support/helpers/activejob_helpers.rb +27 -0
  31. data/spec/support/helpers/dependency_helper.rb +13 -1
  32. data/spec/support/helpers/transaction_helpers.rb +10 -0
  33. metadata +10 -5
  34. data/spec/support/mocks/mock_extension.rb +0 -6
@@ -251,14 +251,14 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
251
251
 
252
252
  it "adds the installation report to the diagnostics report" do
253
253
  run
254
- jruby = DependencyHelper.running_jruby?
254
+ jruby = Appsignal::System.jruby?
255
255
  expect(received_report["installation"]).to match(
256
256
  "result" => {
257
257
  "status" => "success"
258
258
  },
259
259
  "language" => {
260
260
  "name" => "ruby",
261
- "version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}",
261
+ "version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}",
262
262
  "implementation" => jruby ? "jruby" : "ruby"
263
263
  },
264
264
  "download" => {
@@ -295,7 +295,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
295
295
  " Status: success",
296
296
  "Language details",
297
297
  " Implementation: \"#{jruby ? "jruby" : "ruby"}\"",
298
- " Ruby version: \"#{"#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"}\"",
298
+ " Ruby version: \"#{"#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"}\"",
299
299
  "Download details",
300
300
  " Download URL: \"https://",
301
301
  " Checksum: \"verified\"",
@@ -321,7 +321,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
321
321
  expect(File).to receive(:read)
322
322
  .with(File.expand_path("../../../../../ext/install.report", __FILE__))
323
323
  .and_return(
324
- YAML.dump(
324
+ JSON.generate(
325
325
  "result" => {
326
326
  "status" => "error",
327
327
  "error" => "RuntimeError: some error",
@@ -384,8 +384,8 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
384
384
  end
385
385
  end
386
386
 
387
- context "when report is invalid YAML" do
388
- let(:raw_report) { "foo:\nbar" }
387
+ context "when report is invalid JSON" do
388
+ let(:raw_report) { "{}-" }
389
389
  before do
390
390
  allow(File).to receive(:read).and_call_original
391
391
  expect(File).to receive(:read)
@@ -604,7 +604,7 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
604
604
 
605
605
  describe "host information" do
606
606
  let(:rbconfig) { RbConfig::CONFIG }
607
- let(:language_version) { "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}" }
607
+ let(:language_version) { "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}" }
608
608
 
609
609
  it "outputs host information" do
610
610
  run
@@ -769,13 +769,14 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
769
769
  it "transmits validation in report" do
770
770
  default_config = hash_with_string_keys(Appsignal::Config::DEFAULT_CONFIG)
771
771
  expect(received_report["config"]).to eq(
772
- "options" => default_config.merge("env" => ""),
772
+ "options" => default_config.merge("env" => "", "send_session_data" => true),
773
773
  "sources" => {
774
774
  "default" => default_config,
775
775
  "system" => {},
776
776
  "initial" => { "env" => "" },
777
777
  "file" => {},
778
- "env" => {}
778
+ "env" => {},
779
+ "override" => { "send_session_data" => true }
779
780
  }
780
781
  )
781
782
  end
@@ -893,7 +894,8 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
893
894
  "system" => {},
894
895
  "initial" => hash_with_string_keys(config.initial_config.merge(additional_initial_config)),
895
896
  "file" => hash_with_string_keys(config.file_config),
896
- "env" => {}
897
+ "env" => {},
898
+ "override" => { "send_session_data" => true }
897
899
  }
898
900
  )
899
901
  end
@@ -920,7 +922,8 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
920
922
  "system" => {},
921
923
  "initial" => hash_with_string_keys(config.initial_config),
922
924
  "file" => hash_with_string_keys(config.file_config),
923
- "env" => {}
925
+ "env" => {},
926
+ "override" => { "send_session_data" => true }
924
927
  }
925
928
  )
926
929
  end
@@ -69,8 +69,8 @@ describe Appsignal::Config do
69
69
  end
70
70
 
71
71
  it "sets the push_api_key as loaded through the env_config" do
72
- expect(config.env_config).to eq(:push_api_key => "abc")
73
- expect(config.system_config).to eq(:active => true)
72
+ expect(config.env_config).to include(:push_api_key => "abc")
73
+ expect(config.system_config).to include(:active => true)
74
74
  end
75
75
  end
76
76
 
@@ -82,8 +82,8 @@ describe Appsignal::Config do
82
82
  end
83
83
 
84
84
  it "sets the push_api_key as loaded through the env_config" do
85
- expect(config.env_config).to eq(:push_api_key => "")
86
- expect(config.system_config).to be_empty
85
+ expect(config.env_config).to include(:push_api_key => "")
86
+ expect(config.system_config).to_not have_key(:active)
87
87
  end
88
88
  end
89
89
 
@@ -95,8 +95,8 @@ describe Appsignal::Config do
95
95
  end
96
96
 
97
97
  it "sets the push_api_key as loaded through the env_config" do
98
- expect(config.env_config).to eq(:push_api_key => " ")
99
- expect(config.system_config).to be_empty
98
+ expect(config.env_config).to include(:push_api_key => " ")
99
+ expect(config.system_config).to_not have_key(:active)
100
100
  end
101
101
  end
102
102
  end
@@ -119,7 +119,7 @@ describe Appsignal::Config do
119
119
  end
120
120
 
121
121
  it "sets the log as loaded through the system" do
122
- expect(config.system_config).to eq(:log => "stdout")
122
+ expect(config.system_config).to include(:log => "stdout")
123
123
  end
124
124
  end
125
125
 
@@ -129,7 +129,7 @@ describe Appsignal::Config do
129
129
  end
130
130
 
131
131
  it "does not set log as loaded through the system" do
132
- expect(config.system_config).to eq({})
132
+ expect(config.system_config).to_not have_key(:log)
133
133
  end
134
134
  end
135
135
  end
@@ -177,7 +177,7 @@ describe Appsignal::Config do
177
177
  :revision => "v2.5.1",
178
178
  :send_environment_metadata => true,
179
179
  :send_params => true,
180
- :skip_session_data => false,
180
+ :send_session_data => true,
181
181
  :transaction_debug_mode => false
182
182
  )
183
183
  end
@@ -434,6 +434,87 @@ describe Appsignal::Config do
434
434
  end
435
435
  end
436
436
 
437
+ describe "with config based on overrides" do
438
+ let(:log_stream) { StringIO.new }
439
+ let(:logger) { test_logger(log_stream) }
440
+ let(:logs) { log_contents(log_stream) }
441
+ let(:config) do
442
+ described_class.new(Dir.pwd, "production", config_options, logger)
443
+ end
444
+
445
+ describe "skip_session_data" do
446
+ let(:err_stream) { std_stream }
447
+ let(:stderr) { err_stream.read }
448
+ let(:deprecation_message) do
449
+ "The `skip_session_data` config option is deprecated. Please use " \
450
+ "`send_session_data` instead."
451
+ end
452
+ before do
453
+ capture_std_streams(std_stream, err_stream) { config }
454
+ end
455
+
456
+ context "when not set" do
457
+ let(:config_options) { {} }
458
+
459
+ it "sets the default send_session_data value" do
460
+ expect(config[:skip_session_data]).to be_nil
461
+ expect(config[:send_session_data]).to eq(true)
462
+ expect(config.override_config[:send_session_data]).to eq(true)
463
+ end
464
+
465
+ it "does not print a deprecation warning" do
466
+ expect(stderr).to_not include("appsignal WARNING: #{deprecation_message}")
467
+ expect(logs).to_not include(deprecation_message)
468
+ end
469
+ end
470
+
471
+ context "when set to true" do
472
+ let(:config_options) { { :skip_session_data => true } }
473
+
474
+ it "sets send_session_data if send_session_data is not set by the user" do
475
+ expect(config[:skip_session_data]).to eq(true)
476
+ expect(config[:send_session_data]).to eq(false)
477
+ expect(config.override_config[:send_session_data]).to eq(false)
478
+ end
479
+
480
+ it "prints a deprecation warning" do
481
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
482
+ expect(logs).to include(deprecation_message)
483
+ end
484
+ end
485
+
486
+ context "when set to false" do
487
+ let(:config_options) { { :skip_session_data => false } }
488
+
489
+ it "sets send_session_data if send_session_data is not set by the user" do
490
+ expect(config[:skip_session_data]).to eq(false)
491
+ expect(config[:send_session_data]).to eq(true)
492
+ expect(config.override_config[:send_session_data]).to eq(true)
493
+ end
494
+
495
+ it "prints a deprecation warning" do
496
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
497
+ expect(logs).to include(deprecation_message)
498
+ end
499
+ end
500
+
501
+ context "when skip_session_data and send_session_data are both set" do
502
+ let(:config_options) { { :skip_session_data => true, :send_session_data => true } }
503
+
504
+ it "does not overwrite the send_session_data value" do
505
+ expect(config[:skip_session_data]).to eq(true)
506
+ expect(config[:send_session_data]).to eq(true)
507
+ expect(config.override_config[:send_session_data]).to be_nil
508
+ end
509
+
510
+ it "prints a deprecation warning" do
511
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
512
+ expect(logs).to include(deprecation_message)
513
+ end
514
+ end
515
+ end
516
+ end
517
+
437
518
  describe "config keys" do
438
519
  describe ":endpoint" do
439
520
  subject { config[:endpoint] }
@@ -743,6 +824,54 @@ describe Appsignal::Config do
743
824
  end
744
825
  end
745
826
 
827
+ describe "#maintain_backwards_compatibility" do
828
+ let(:log_stream) { StringIO.new }
829
+ let(:logger) { test_logger(log_stream) }
830
+ let(:logs) { log_contents(log_stream) }
831
+ let(:config) do
832
+ described_class.new(Dir.pwd, "production", config_options, logger)
833
+ end
834
+
835
+ describe "working_dir_path" do
836
+ let(:err_stream) { std_stream }
837
+ let(:stderr) { err_stream.read }
838
+ let(:deprecation_message) do
839
+ "The `working_dir_path` option is deprecated, please use " \
840
+ "`working_directory_path` instead and specify the " \
841
+ "full path to the working directory"
842
+ end
843
+ before do
844
+ capture_std_streams(std_stream, err_stream) { config }
845
+ end
846
+
847
+ context "when not set" do
848
+ let(:config_options) { {} }
849
+
850
+ it "sets the default working_dir_path value" do
851
+ expect(config[:working_dir_path]).to be_nil
852
+ end
853
+
854
+ it "does not print a deprecation warning" do
855
+ expect(stderr).to_not include("appsignal WARNING: #{deprecation_message}")
856
+ expect(logs).to_not include(deprecation_message)
857
+ end
858
+ end
859
+
860
+ context "when set" do
861
+ let(:config_options) { { :working_dir_path => "/tmp/appsignal2" } }
862
+
863
+ it "sets the default working_dir_path value" do
864
+ expect(config[:working_dir_path]).to eq("/tmp/appsignal2")
865
+ end
866
+
867
+ it "does not print a deprecation warning" do
868
+ expect(stderr).to include("appsignal WARNING: #{deprecation_message}")
869
+ expect(logs).to include(deprecation_message)
870
+ end
871
+ end
872
+ end
873
+ end
874
+
746
875
  describe "#validate" do
747
876
  subject { config.valid? }
748
877
  let(:config) do
@@ -1,5 +1,5 @@
1
- describe Appsignal::EventFormatter::ActiveRecord::InstantiationFormatter do
2
- let(:klass) { Appsignal::EventFormatter::ActiveRecord::SqlFormatter }
1
+ describe Appsignal::EventFormatter::ActiveRecord::SqlFormatter do
2
+ let(:klass) { described_class }
3
3
  let(:formatter) { klass.new }
4
4
 
5
5
  it "should register sql.active_record" do
@@ -11,8 +11,12 @@ describe Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter do
11
11
  end
12
12
 
13
13
  it "should apply a strategy for each key" do
14
+ # TODO: additional curly brackets required for issue
15
+ # https://github.com/rspec/rspec-mocks/issues/1460
16
+ # rubocop:disable Style/BracesAroundHashParameters
14
17
  expect(formatter).to receive(:apply_strategy)
15
- .with(:sanitize_document, "_id" => 1)
18
+ .with(:sanitize_document, { "_id" => 1 })
19
+ # rubocop:enable Style/BracesAroundHashParameters
16
20
 
17
21
  expect(formatter).to receive(:apply_strategy)
18
22
  .with(:allow, "users")
@@ -47,57 +51,27 @@ describe Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter do
47
51
  end
48
52
  end
49
53
 
50
- context "when strategy is deny" do
51
- let(:strategy) { :deny }
52
- let(:value) { { "_id" => 1 } }
53
-
54
- it "should return a '?'" do
55
- expect(formatter.apply_strategy(strategy, value)).to eql("?")
56
- end
57
- end
58
-
59
- context "when strategy is deny_array" do
60
- let(:strategy) { :deny_array }
61
- let(:value) { { "_id" => 1 } }
62
-
63
- it "should return a sanitized array string" do
64
- expect(formatter.apply_strategy(strategy, value)).to eql("[?]")
65
- end
66
- end
67
-
68
54
  context "when strategy is sanitize_document" do
69
55
  let(:strategy) { :sanitize_document }
70
- let(:value) { { "_id" => 1 } }
71
-
72
- it "should return a sanitized document" do
73
- expect(formatter.apply_strategy(strategy, value)).to eql("_id" => "?")
74
- end
75
- end
76
-
77
- context "when strategy is sanitize_bulk" do
78
- let(:strategy) { :sanitize_bulk }
79
- let(:value) { [{ "q" => { "_id" => 1 }, "u" => [{ "foo" => "bar" }] }] }
80
-
81
- it "should return an array of sanitized bulk documents" do
82
- expect(formatter.apply_strategy(strategy, value)).to eql([
83
- { "q" => { "_id" => "?" }, "u" => "[?]" }
84
- ])
56
+ let(:value) do
57
+ {
58
+ "_id" => 1,
59
+ "authors" => [
60
+ { "name" => "BarBaz" },
61
+ { "name" => "FooBar" },
62
+ { "name" => "BarFoo", "surname" => "Baz" }
63
+ ]
64
+ }
85
65
  end
86
66
 
87
- context "when bulk has more than one update" do
88
- let(:value) do
89
- [
90
- { "q" => { "_id" => 1 }, "u" => [{ "foo" => "bar" }] },
91
- { "q" => { "_id" => 2 }, "u" => [{ "foo" => "baz" }] }
67
+ it "should return a sanitized document" do
68
+ expect(formatter.apply_strategy(strategy, value)).to eql(
69
+ "_id" => "?",
70
+ "authors" => [
71
+ { "name" => "?" },
72
+ { "name" => "?", "surname" => "?" }
92
73
  ]
93
- end
94
-
95
- it "should return only the first value of sanitized bulk documents" do
96
- expect(formatter.apply_strategy(strategy, value)).to eql([
97
- { "q" => { "_id" => "?" }, "u" => "[?]" },
98
- "[...]"
99
- ])
100
- end
74
+ )
101
75
  end
102
76
  end
103
77
 
@@ -0,0 +1,30 @@
1
+ describe Appsignal::EventFormatter::Sequel::SqlFormatter do
2
+ let(:klass) { described_class }
3
+ let(:formatter) { klass.new }
4
+
5
+ it "registers the sql.sequel event formatter" do
6
+ expect(Appsignal::EventFormatter.registered?("sql.sequel", klass)).to be_truthy
7
+ end
8
+
9
+ describe "#format" do
10
+ before do
11
+ stub_const(
12
+ "SequelDatabaseTypeClass",
13
+ Class.new do
14
+ def self.to_s
15
+ "SequelDatabaseTypeClassToString"
16
+ end
17
+ end
18
+ )
19
+ end
20
+ let(:payload) do
21
+ {
22
+ :name => SequelDatabaseTypeClass,
23
+ :sql => "SELECT * FROM users"
24
+ }
25
+ end
26
+ subject { formatter.format(payload) }
27
+
28
+ it { is_expected.to eq ["SequelDatabaseTypeClassToString", "SELECT * FROM users", 1] }
29
+ end
30
+ end
@@ -30,6 +30,7 @@ if DependencyHelper.active_job_present?
30
30
  end
31
31
 
32
32
  describe Appsignal::Hooks::ActiveJobHook::ActiveJobClassInstrumentation do
33
+ include ActiveJobHelpers
33
34
  let(:time) { Time.parse("2001-01-01 10:00:00UTC") }
34
35
  let(:namespace) { Appsignal::Transaction::BACKGROUND_JOB }
35
36
  let(:queue) { "default" }
@@ -65,7 +66,7 @@ if DependencyHelper.active_job_present?
65
66
  ]
66
67
  end
67
68
  let(:expected_perform_events) do
68
- if DependencyHelper.rails_version >= Gem::Version.new("7.0.0")
69
+ if DependencyHelper.rails7_present?
69
70
  ["perform.active_job", "perform_start.active_job"]
70
71
  else
71
72
  ["perform_start.active_job", "perform.active_job"]
@@ -597,23 +598,5 @@ if DependencyHelper.active_job_present?
597
598
  "_aj_symbol_keys"
598
599
  end
599
600
  end
600
-
601
- def active_job_args_wrapper(args: [], params: nil)
602
- if DependencyHelper.rails_version >= Gem::Version.new("7.0.0")
603
- wrapped_args = {
604
- "_aj_ruby2_keywords" => ["args"],
605
- "args" => args
606
- }
607
-
608
- unless params.nil?
609
- wrapped_args["params"] = params
610
- wrapped_args["_aj_ruby2_keywords"] = ["params", "args"]
611
- end
612
-
613
- [wrapped_args]
614
- else
615
- params.nil? ? args : args + [params]
616
- end
617
- end
618
601
  end
619
602
  end
@@ -1,7 +1,7 @@
1
1
  describe Appsignal::Hooks::SequelHook do
2
2
  if DependencyHelper.sequel_present?
3
3
  let(:db) do
4
- if Appsignal::System.jruby?
4
+ if DependencyHelper.running_jruby?
5
5
  Sequel.connect("jdbc:sqlite::memory:")
6
6
  else
7
7
  Sequel.sqlite
@@ -17,8 +17,12 @@ describe Appsignal::Hooks::MongoMonitorSubscriber do
17
17
  end
18
18
 
19
19
  it "should sanitize command" do
20
+ # TODO: additional curly brackets required for issue
21
+ # https://github.com/rspec/rspec-mocks/issues/1460
22
+ # rubocop:disable Style/BracesAroundHashParameters
20
23
  expect(Appsignal::EventFormatter::MongoRubyDriver::QueryFormatter)
21
- .to receive(:format).with("find", "foo" => "bar")
24
+ .to receive(:format).with("find", { "foo" => "bar" })
25
+ # rubocop:enable Style/BracesAroundHashParameters
22
26
 
23
27
  subscriber.started(event)
24
28
  end
@@ -228,10 +228,14 @@ describe Appsignal::Integrations::SidekiqMiddleware, :with_yaml_parse_error => f
228
228
  let(:error) { ExampleException }
229
229
 
230
230
  it "creates a transaction and adds the error" do
231
+ # TODO: additional curly brackets required for issue
232
+ # https://github.com/rspec/rspec-mocks/issues/1460
233
+ # rubocop:disable Style/BracesAroundHashParameters
231
234
  expect(Appsignal).to receive(:increment_counter)
232
- .with("sidekiq_queue_job_count", 1, :queue => "default", :status => :failed)
235
+ .with("sidekiq_queue_job_count", 1, { :queue => "default", :status => :failed })
233
236
  expect(Appsignal).to receive(:increment_counter)
234
- .with("sidekiq_queue_job_count", 1, :queue => "default", :status => :processed)
237
+ .with("sidekiq_queue_job_count", 1, { :queue => "default", :status => :processed })
238
+ # rubocop:enable Style/BracesAroundHashParameters
235
239
 
236
240
  expect do
237
241
  perform_job { raise error, "uh oh" }
@@ -267,8 +271,12 @@ describe Appsignal::Integrations::SidekiqMiddleware, :with_yaml_parse_error => f
267
271
 
268
272
  context "without an error" do
269
273
  it "creates a transaction with events" do
274
+ # TODO: additional curly brackets required for issue
275
+ # https://github.com/rspec/rspec-mocks/issues/1460
276
+ # rubocop:disable Style/BracesAroundHashParameters
270
277
  expect(Appsignal).to receive(:increment_counter)
271
- .with("sidekiq_queue_job_count", 1, :queue => "default", :status => :processed)
278
+ .with("sidekiq_queue_job_count", 1, { :queue => "default", :status => :processed })
279
+ # rubocop:enable Style/BracesAroundHashParameters
272
280
 
273
281
  perform_job
274
282
 
@@ -339,6 +347,7 @@ if DependencyHelper.active_job_present?
339
347
  require "sidekiq/testing"
340
348
 
341
349
  describe "Sidekiq ActiveJob integration" do
350
+ include ActiveJobHelpers
342
351
  let(:namespace) { Appsignal::Transaction::BACKGROUND_JOB }
343
352
  let(:time) { Time.parse("2001-01-01 10:00:00UTC") }
344
353
  let(:log) { StringIO.new }
@@ -367,7 +376,7 @@ if DependencyHelper.active_job_present?
367
376
  ]
368
377
  end
369
378
  let(:expected_wrapped_args) do
370
- if DependencyHelper.rails_version >= Gem::Version.new("7.0.0")
379
+ if (DependencyHelper.rails6_1_present? && DependencyHelper.ruby_3_1_or_newer?) || DependencyHelper.rails7_present?
371
380
  [{
372
381
  "_aj_ruby2_keywords" => ["args"],
373
382
  "args" => expected_args
@@ -385,7 +394,7 @@ if DependencyHelper.active_job_present?
385
394
  end
386
395
  end
387
396
  let(:expected_perform_events) do
388
- if DependencyHelper.rails_version >= Gem::Version.new("7.0.0")
397
+ if DependencyHelper.rails7_present?
389
398
  ["perform_job.sidekiq", "perform.active_job", "perform_start.active_job"]
390
399
  else
391
400
  ["perform_job.sidekiq", "perform_start.active_job", "perform.active_job"]
@@ -1282,8 +1282,8 @@ describe Appsignal::Transaction do
1282
1282
  end
1283
1283
  end
1284
1284
 
1285
- context "when skipping session data" do
1286
- before { Appsignal.config[:skip_session_data] = true }
1285
+ context "when not sending session data" do
1286
+ before { Appsignal.config[:send_session_data] = false }
1287
1287
 
1288
1288
  it "does not set any session data on the transaction" do
1289
1289
  expect(subject).to be_nil
@@ -117,7 +117,7 @@ describe Appsignal::Utils::QueryParamsSanitizer do
117
117
  context "when value is an array" do
118
118
  let(:value) { %w[foo bar] }
119
119
 
120
- it "should sanitize all hash values with a single questionmark" do
120
+ it "should sanitize all hash values with a single question mark" do
121
121
  expect(subject).to eq(["?"])
122
122
  end
123
123
  end
@@ -125,7 +125,7 @@ describe Appsignal::Utils::QueryParamsSanitizer do
125
125
  context "when value is a mixed array" do
126
126
  let(:value) { [nil, "foo", "bar"] }
127
127
 
128
- it "should sanitize all hash values with a single questionmark" do
128
+ it "should sanitize all hash values with a single question mark" do
129
129
  expect(subject).to eq(["?"])
130
130
  end
131
131
  end