jmeter_perf 1.1.0 → 1.1.1
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/lib/jmeter_perf/report/summary.rb +13 -16
- data/lib/jmeter_perf/version.rb +1 -1
- data/lib/jmeter_perf.rb +7 -7
- data/sig/jmeter_perf.rbs +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 600531edf66d0d72c64c6015327f9b63db03ab11357e28758a7250aead0d9106
|
4
|
+
data.tar.gz: f254970ad87fb7850e4989d25c3f6437cb037614a76cd5c145b6c3bb5db6b4a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c69cb7eac86ce588226a5c69a4b791e7d4f9015034c2314f9c13daab0a5dbeab5feeaaaaf6f58fe9be22c3216ac99e94f9d0e718cc1027ea4aa0d2e43e43a7
|
7
|
+
data.tar.gz: 2608a6d4db406a42a9bbaf2874e2cebfdb0768b62100e5515eb68a098683fc191410632aa9c314c0b17a8884405fc314499473d7335dc4d4177b3c56e8f3abfe
|
@@ -188,33 +188,27 @@ module JmeterPerf
|
|
188
188
|
|
189
189
|
# Starts streaming and processing JTL file content asynchronously.
|
190
190
|
# @note Once streaming, in order to finish processing, call `finish!` otherwise it will continue indefinitely.
|
191
|
-
# @return [
|
191
|
+
# @return [void]
|
192
192
|
def stream_jtl_async
|
193
193
|
@processing_jtl_thread = Thread.new do
|
194
|
-
Timeout.timeout(@jtl_read_timeout) do
|
194
|
+
Timeout.timeout(@jtl_read_timeout, nil, "Timed out attempting to open JTL File #{@file_path}") do
|
195
195
|
sleep 0.1 until File.exist?(@file_path) # Wait for the file to be created
|
196
196
|
end
|
197
197
|
|
198
198
|
File.open(@file_path, "r") do |file|
|
199
199
|
until @finished && file.eof?
|
200
|
-
line =
|
201
|
-
|
202
|
-
# Protect against blocking reads that are still in progress
|
203
|
-
Timeout.timeout(@jtl_read_timeout) do
|
204
|
-
line = file.gets
|
205
|
-
sleep 0.1 until line || file.eof? || @finished
|
206
|
-
end
|
200
|
+
line = file.gets
|
207
201
|
|
208
|
-
# Skip if the line is nil.
|
202
|
+
# Skip if the line is nil. This can happen if not @finished, and we are at EOF
|
209
203
|
next if line.nil?
|
210
|
-
# Process only if the line is complete
|
204
|
+
# Process only if the line is complete. JMeter always finishes with a newline
|
211
205
|
read_until_complete_line(file, line)
|
212
206
|
end
|
213
207
|
end
|
214
208
|
end
|
215
209
|
|
216
210
|
@processing_jtl_thread.abort_on_exception = true
|
217
|
-
|
211
|
+
nil
|
218
212
|
end
|
219
213
|
|
220
214
|
# Summarizes the collected data by calculating statistical metrics and error rates.
|
@@ -232,16 +226,19 @@ module JmeterPerf
|
|
232
226
|
private
|
233
227
|
|
234
228
|
def read_until_complete_line(file, line)
|
235
|
-
|
236
|
-
|
237
|
-
|
229
|
+
lineno = file.lineno
|
230
|
+
return if lineno == 1 # Skip the header row
|
231
|
+
Timeout.timeout(@jtl_read_timeout, nil, "Timed out processing line #{lineno}") do
|
232
|
+
# If finished and eof but no newline: Means processing was interrupted
|
233
|
+
# JMeter always finishes with a new line in the JTL file
|
234
|
+
until line.end_with?("\n") || (file.eof? && @finished)
|
238
235
|
sleep 0.1
|
239
236
|
line += file.gets.to_s
|
240
237
|
end
|
241
238
|
end
|
242
239
|
parse_csv_row(line)
|
243
240
|
rescue Timeout::Error
|
244
|
-
raise Timeout::Error, "Timed out reading JTL file at line #{
|
241
|
+
raise Timeout::Error, "Timed out reading JTL file at line #{lineno}"
|
245
242
|
rescue CSV::MalformedCSVError
|
246
243
|
@csv_error_lines << file.lineno
|
247
244
|
end
|
data/lib/jmeter_perf/version.rb
CHANGED
data/lib/jmeter_perf.rb
CHANGED
@@ -61,7 +61,7 @@ module JmeterPerf
|
|
61
61
|
@root = Nokogiri::XML(JmeterPerf::Helpers::String.strip_heredoc(
|
62
62
|
<<-EOF
|
63
63
|
<?xml version="1.0" encoding="UTF-8"?>
|
64
|
-
<jmeterTestPlan version="1.2" properties="3.1" jmeter="3.1"
|
64
|
+
<jmeterTestPlan version="1.2" properties="3.1" jmeter="3.1" jmeterperf="#{JmeterPerf::VERSION}">
|
65
65
|
<hashTree>
|
66
66
|
</hashTree>
|
67
67
|
</jmeterTestPlan>
|
@@ -74,17 +74,17 @@ module JmeterPerf
|
|
74
74
|
|
75
75
|
# Saves the test plan as a JMX file.
|
76
76
|
#
|
77
|
-
# @param out_jmx [String] The path for the output JMX file (default: `"
|
78
|
-
def jmx(out_jmx: "
|
77
|
+
# @param out_jmx [String] The path for the output JMX file (default: `"jmeter_perf.jmx"`).
|
78
|
+
def jmx(out_jmx: "jmeter_perf.jmx")
|
79
79
|
File.write(out_jmx, doc.to_xml(indent: 2))
|
80
80
|
logger.info "JMX saved to: #{out_jmx}"
|
81
81
|
end
|
82
82
|
|
83
83
|
# Runs the test plan with the specified configuration.
|
84
84
|
#
|
85
|
-
# @param name [String] The name of the test run (default: `"
|
85
|
+
# @param name [String] The name of the test run (default: `"jmeter_perf"`).
|
86
86
|
# @param jmeter_path [String] Path to the JMeter executable (default: `"jmeter"`).
|
87
|
-
# @param out_jmx [String] The filename for the output JMX file (default: `"
|
87
|
+
# @param out_jmx [String] The filename for the output JMX file (default: `"jmeter_perf.jmx"`).
|
88
88
|
# @param out_jtl [String] The filename for the output JTL file (default: `"jmeter.jtl"`).
|
89
89
|
# @param out_jmeter_log [String] The filename for the JMeter log file (default: `"jmeter.log"`).
|
90
90
|
# @param out_cmd_log [String] The filename for the command log file (default: `"jmeter-cmd.log"`).
|
@@ -92,9 +92,9 @@ module JmeterPerf
|
|
92
92
|
# @return [JmeterPerf::Report::Summary] The summary report of the test run.
|
93
93
|
# @raise [RuntimeError] If the test execution fails.
|
94
94
|
def run(
|
95
|
-
name: "
|
95
|
+
name: "jmeter_perf",
|
96
96
|
jmeter_path: "jmeter",
|
97
|
-
out_jmx: "
|
97
|
+
out_jmx: "jmeter_perf.jmx",
|
98
98
|
out_jtl: "jmeter.jtl",
|
99
99
|
out_jmeter_log: "jmeter.log",
|
100
100
|
out_cmd_log: "jmeter-cmd.log",
|
data/sig/jmeter_perf.rbs
CHANGED
@@ -9,11 +9,11 @@ module JmeterPerf
|
|
9
9
|
attr_accessor root: ::Nokogiri::XML::Document
|
10
10
|
|
11
11
|
def initialize: (params: Hash[Symbol, untyped] ?) -> void
|
12
|
-
def jmx: (out_jmx: String = "
|
12
|
+
def jmx: (out_jmx: String = "jmeter_perf.jmx") -> void
|
13
13
|
def run: (
|
14
|
-
name: String = "
|
14
|
+
name: String = "jmeter_perf",
|
15
15
|
jmeter_path: String = "jmeter",
|
16
|
-
out_jmx: String = "
|
16
|
+
out_jmx: String = "jmeter_perf.jmx",
|
17
17
|
out_jtl: String = "jmeter.jtl",
|
18
18
|
out_jmeter_log: String = "jmeter.log",
|
19
19
|
out_cmd_log: String = "jmeter-cmd.log",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jmeter_perf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Luis Urena
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|