appsignal 4.0.5-java → 4.0.6-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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +151 -16
- data/CHANGELOG.md +8 -0
- data/build_matrix.yml +2 -1
- data/ext/agent.rb +27 -27
- data/gemfiles/que-1.gemfile +5 -0
- data/gemfiles/que-2.gemfile +5 -0
- data/lib/appsignal/check_in/scheduler.rb +3 -4
- data/lib/appsignal/integrations/que.rb +8 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/check_in/cron_spec.rb +59 -51
- data/spec/lib/appsignal/check_in/scheduler_spec.rb +240 -126
- data/spec/lib/appsignal/integrations/que_spec.rb +56 -21
- data/spec/lib/appsignal/probes_spec.rb +3 -0
- data/spec/lib/appsignal/transaction_spec.rb +96 -92
- data/spec/spec_helper.rb +6 -0
- data/spec/support/helpers/api_request_helper.rb +40 -0
- data/spec/support/helpers/dependency_helper.rb +5 -0
- data/spec/support/testing.rb +9 -0
- metadata +4 -3
- data/gemfiles/que.gemfile +0 -5
@@ -4,16 +4,13 @@ describe Appsignal::CheckIn::Cron do
|
|
4
4
|
let(:appsignal_options) { {} }
|
5
5
|
let(:config) { project_fixture_config }
|
6
6
|
let(:cron_checkin) { described_class.new(:identifier => "cron-checkin-name") }
|
7
|
-
let(:
|
8
|
-
let(:scheduler) { Appsignal::CheckIn::Scheduler.new }
|
7
|
+
let(:scheduler) { Appsignal::CheckIn.scheduler }
|
9
8
|
|
10
9
|
before do
|
11
10
|
start_agent(
|
12
11
|
:options => appsignal_options,
|
13
12
|
:internal_logger => test_logger(log_stream)
|
14
13
|
)
|
15
|
-
allow(Appsignal::CheckIn).to receive(:scheduler).and_return(scheduler)
|
16
|
-
allow(Appsignal::CheckIn).to receive(:transmitter).and_return(transmitter)
|
17
14
|
end
|
18
15
|
after { stop_scheduler }
|
19
16
|
|
@@ -64,11 +61,13 @@ describe Appsignal::CheckIn::Cron do
|
|
64
61
|
it "sends a cron check-in start" do
|
65
62
|
cron_checkin.start
|
66
63
|
|
67
|
-
|
68
|
-
:
|
69
|
-
|
70
|
-
|
71
|
-
|
64
|
+
stub_check_in_request(
|
65
|
+
:events => [
|
66
|
+
"identifier" => "cron-checkin-name",
|
67
|
+
"kind" => "start",
|
68
|
+
"check_in_type" => "cron"
|
69
|
+
]
|
70
|
+
)
|
72
71
|
|
73
72
|
scheduler.stop
|
74
73
|
|
@@ -86,11 +85,14 @@ describe Appsignal::CheckIn::Cron do
|
|
86
85
|
it "logs an error if it fails" do
|
87
86
|
cron_checkin.start
|
88
87
|
|
89
|
-
|
90
|
-
:
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
stub_check_in_request(
|
89
|
+
:events => [
|
90
|
+
"identifier" => "cron-checkin-name",
|
91
|
+
"kind" => "start",
|
92
|
+
"check_in_type" => "cron"
|
93
|
+
],
|
94
|
+
:response => { :status => 499 }
|
95
|
+
)
|
94
96
|
|
95
97
|
scheduler.stop
|
96
98
|
|
@@ -109,11 +111,13 @@ describe Appsignal::CheckIn::Cron do
|
|
109
111
|
it "sends a cron check-in finish" do
|
110
112
|
cron_checkin.finish
|
111
113
|
|
112
|
-
|
113
|
-
:
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
stub_check_in_request(
|
115
|
+
:events => [
|
116
|
+
"identifier" => "cron-checkin-name",
|
117
|
+
"kind" => "finish",
|
118
|
+
"check_in_type" => "cron"
|
119
|
+
]
|
120
|
+
)
|
117
121
|
|
118
122
|
scheduler.stop
|
119
123
|
expect(logs).to_not contains_log(:error)
|
@@ -130,11 +134,14 @@ describe Appsignal::CheckIn::Cron do
|
|
130
134
|
it "logs an error if it fails" do
|
131
135
|
cron_checkin.finish
|
132
136
|
|
133
|
-
|
134
|
-
:
|
135
|
-
|
136
|
-
|
137
|
-
|
137
|
+
stub_check_in_request(
|
138
|
+
:events => [
|
139
|
+
"identifier" => "cron-checkin-name",
|
140
|
+
"kind" => "finish",
|
141
|
+
"check_in_type" => "cron"
|
142
|
+
],
|
143
|
+
:response => { :status => 499 }
|
144
|
+
)
|
138
145
|
|
139
146
|
scheduler.stop
|
140
147
|
|
@@ -152,34 +159,33 @@ describe Appsignal::CheckIn::Cron do
|
|
152
159
|
describe ".cron" do
|
153
160
|
describe "when a block is given" do
|
154
161
|
it "sends a cron check-in start and finish and return the block output" do
|
155
|
-
|
156
|
-
:
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
:
|
164
|
-
|
165
|
-
|
162
|
+
stub_check_in_request(
|
163
|
+
:events => [
|
164
|
+
"identifier" => "cron-checkin-with-block",
|
165
|
+
"kind" => "start",
|
166
|
+
"check_in_type" => "cron"
|
167
|
+
]
|
168
|
+
)
|
169
|
+
stub_check_in_request(
|
170
|
+
:events => [
|
171
|
+
"identifier" => "cron-checkin-with-block",
|
172
|
+
"kind" => "finish",
|
173
|
+
"check_in_type" => "cron"
|
174
|
+
]
|
175
|
+
)
|
166
176
|
|
167
177
|
output = Appsignal::CheckIn.cron("cron-checkin-with-block") { "output" }
|
168
178
|
expect(output).to eq("output")
|
169
179
|
end
|
170
180
|
|
171
181
|
it "does not send a cron check-in finish event when an error is raised" do
|
172
|
-
|
173
|
-
:
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
:kind => "finish",
|
180
|
-
:identifier => "cron-checkin-with-block",
|
181
|
-
:check_in_type => "cron"
|
182
|
-
))
|
182
|
+
stub_check_in_request(
|
183
|
+
:events => [
|
184
|
+
"identifier" => "cron-checkin-with-block",
|
185
|
+
"kind" => "start",
|
186
|
+
"check_in_type" => "cron"
|
187
|
+
]
|
188
|
+
)
|
183
189
|
|
184
190
|
expect do
|
185
191
|
Appsignal::CheckIn.cron("cron-checkin-with-block") { raise "error" }
|
@@ -189,11 +195,13 @@ describe Appsignal::CheckIn::Cron do
|
|
189
195
|
|
190
196
|
describe "when no block is given" do
|
191
197
|
it "only sends a cron check-in finish event" do
|
192
|
-
|
193
|
-
:
|
194
|
-
|
195
|
-
|
196
|
-
|
198
|
+
stub_check_in_request(
|
199
|
+
:events => [
|
200
|
+
"identifier" => "cron-checkin-without-block",
|
201
|
+
"kind" => "finish",
|
202
|
+
"check_in_type" => "cron"
|
203
|
+
]
|
204
|
+
)
|
197
205
|
|
198
206
|
Appsignal::CheckIn.cron("cron-checkin-without-block")
|
199
207
|
end
|