This is an automated email from the ASF dual-hosted git repository. vladimirsitnikov pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit 6cc575132c7d9d332d7136e7f027d931585744d5 Author: Vladimir Sitnikov <[email protected]> AuthorDate: Fri May 19 11:31:36 2023 +0300 test: fix assertions in BoltSamplerSpec response.getTime() returns the response time, and it might be 0 in case the response is fast. Fixes https://github.com/apache/jmeter/issues/5919 --- .../jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy index a6062c7949..65e6b09efe 100644 --- a/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy +++ b/src/protocol/bolt/src/test/groovy/org/apache/jmeter/protocol/bolt/sampler/BoltSamplerSpec.groovy @@ -65,7 +65,9 @@ class BoltSamplerSpec extends Specification { str.endsWith("Records: Skipped") response.getSampleCount() == 1 response.getErrorCount() == 0 - response.getTime() > 0 + // The sampler was executed, so start and end times should be set + response.getStartTime() > 0 + response.getEndTime() > 0 } def "should not display results by default"() { @@ -99,7 +101,9 @@ class BoltSamplerSpec extends Specification { str.endsWith("Mock for type 'Record'") response.getSampleCount() == 1 response.getErrorCount() == 0 - response.getTime() > 0 + // The sampler was executed, so start and end times should be set + response.getStartTime() > 0 + response.getEndTime() > 0 } def "should return error on failed query"() { @@ -116,7 +120,9 @@ class BoltSamplerSpec extends Specification { str.contains("a message") response.getSampleCount() == 1 response.getErrorCount() == 1 - response.getTime() > 0 + // The sampler was executed, so start and end times should be set + response.getStartTime() > 0 + response.getEndTime() > 0 } def "should return error on invalid parameters"() { @@ -133,6 +139,9 @@ class BoltSamplerSpec extends Specification { str.contains("Unexpected character") response.getSampleCount() == 1 response.getErrorCount() == 1 + // The sampler fails at parameter preparation, so no time is recorded + response.getStartTime() == 0 + response.getEndTime() == 0 response.getTime() == 0 }
