Skip to content

Commit 4a7ecea

Browse files
committed
Pull request #42: migration new integration tests
Merge in ISGAPPSEC/cyperf-api-wrapper from ISGAPPSEC2-35526-switch-to-new-wrapper-for-integration-tests to main Squashed commit of the following: commit f6fab58b109d2ce7bd1914c5f9e42d4ce9bb409c Author: iustmitu <iustin.mitu@keysight.com> Date: Thu Oct 2 10:45:30 2025 +0300 fix get_first_N_http_standalone_strikes commit e3babe0ca1cccb65aaf918217d4e7a6a62cb26cb Author: iustmitu <iustin.mitu@keysight.com> Date: Wed Oct 1 11:12:48 2025 +0300 get one strike per api call commit 770cd80bd83e037e9f819b467ddb686073ab14c5 Author: iustmitu <iustin.mitu@keysight.com> Date: Mon Sep 29 16:56:05 2025 +0300 updated wrapper utils file
1 parent 3a37c05 commit 4a7ecea

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

cyperf/utils.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,28 @@ def disable_automatic_network(self, session):
204204
ip_net.ip_ranges[0].ip_auto = False
205205
ip_net.update()
206206

207+
def get_first_N_http_standalone_strikes(self, n):
208+
application_api_instance = cyperf.ApplicationResourcesApi(self.api_client)
209+
http_strikes = []
210+
skip = 0
211+
212+
while len(http_strikes) < n:
213+
take = min(50, n - len(http_strikes))
214+
strike_batch = application_api_instance.get_resources_strikes(take=take, skip=skip).data
215+
216+
for strike in strike_batch:
217+
protocol = strike.metadata.protocol
218+
supported_apps = strike.metadata.supported_apps
219+
220+
if protocol.lower() == 'http' and supported_apps == None:
221+
http_strikes.append(strike)
222+
if len(http_strikes) == n:
223+
break
224+
225+
skip += take
226+
227+
return http_strikes
228+
207229
def add_apps(self, session, appNames):
208230
# Retrieve the app from precanned Apps
209231
resource_api = cyperf.ApplicationResourcesApi(self.api_client)
@@ -329,7 +351,7 @@ def format_stats_dict_as_table(self, stats_dict={}):
329351
lines = ['|'.join([f'{val:^{col_width}}' for val, col_width in zip(item, col_widths)]) for item in zip(*stats_dict.values())]
330352
return [line_delim, header, line_delim] + lines + [line_delim]
331353

332-
354+
333355
def parse_cli_options(extra_options=[]):
334356
"""Can be used to get parameters from the CLI or env vars that are broadly useful for CLI tests"""
335357
import argparse

0 commit comments

Comments
 (0)