Refactor(utils): Consolidate response handling into utility functions 02/141102/3
authorsourabh_sourabh <sourabh.sourabh@est.tech>
Wed, 4 Jun 2025 17:22:42 +0000 (18:22 +0100)
committersourabh_sourabh <sourabh.sourabh@est.tech>
Fri, 6 Jun 2025 15:03:28 +0000 (16:03 +0100)
commit63757c351de63101e10add79941adaf530ad0202
treefa112aafd14aabef117b267547755d67ebf882d8
parentebef86567ad8b851610c9d6ddbc5a489d193de42
Refactor(utils): Consolidate response handling into utility functions

Abstracted common HTTP response validation and metric recording logic into reusable utility functions:

- Added `validateAndRecordMetric` for generalized response checks and metric recording.
- Introduced `processHttpResponseWithOverheadMetrics` to handle response times adjusted for known delays.
- Created `validateResponseAndRecordMetric` to validate JSON response lengths and record metrics.

These changes promote code reuse and maintain consistency across test scenarios.

Issue-ID: CPS-2690
Change-Id: Ie4dd1075c65e87c1b48225e096b2b781b098da0f
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
k6-tests/ncmp/common/utils.js
k6-tests/ncmp/ncmp-test-runner.js
k6-tests/ncmp/run-all-tests.sh