本文整理汇总了Python中tests.random_datapoint函数的典型用法代码示例。如果您正苦于以下问题:Python random_datapoint函数的具体用法?Python random_datapoint怎么用?Python random_datapoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了random_datapoint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_stop_counting_criteria
def test_stop_counting_criteria(self):
obj = PassFailStatus()
obj.engine = EngineEmul()
obj.parameters = {"criteria": ["avg-rt>10ms for 2s, continue as failed"]}
obj.prepare()
obj.get_widget()
start_time = time.time()
for _n in range(0, 10):
point = random_datapoint(start_time)
point[DataPoint.CURRENT]['']["avg_rt"] = 1.0
obj.aggregated_second(point)
obj.check()
start_time += 1
self.assertEqual(obj.widget.text_widget.text, "Failed: avg-rt>10ms for 10 sec\n")
for _n in range(0, 10):
point = random_datapoint(start_time)
point[DataPoint.CURRENT]['']["avg_rt"] = 0.01
obj.aggregated_second(point)
obj.check()
start_time += 1
self.assertEqual(obj.widget.text_widget.text, "")
开发者ID:PurdyForks,项目名称:taurus,代码行数:25,代码来源:test_passFailStatus.py
示例2: test_check
def test_check(self):
client = BlazeMeterClientEmul(logging.getLogger(''))
client.results.append({"marker": "ping", 'result': {}})
client.results.append({"marker": "projects", 'result': []})
client.results.append({"marker": "project-create", 'result': {
"id": time.time(),
"name": "boo",
"userId": time.time(),
"description": None,
"created": time.time(),
"updated": time.time(),
"organizationId": None
}})
client.results.append({"marker": "tests", 'result': {}})
client.results.append({"marker": "test-create", 'result': {'id': 'unittest1'}})
client.results.append(
{"marker": "sess-start", 'result': {'session': {'id': 'sess1', 'userId': 1}, 'signature': ''}})
client.results.append({"marker": "first push", 'result': {'session': {}}})
# client.results.append(None) # first check error stats
client.results.append({"marker": "mon push", "result": True})
client.results.append({"marker": "second push", 'result': {'session': {"statusCode": 140, 'status': 'ENDED'}}})
# client.results.append(None) # second check error stats
client.results.append({"marker": "post-proc push", 'result': {'session': {}}})
client.results.append({"marker": "upload1", "result": True}) # post-proc error stats
client.results.append({"marker": "terminate", 'result': {'session': {}}})
obj = BlazeMeterUploader()
obj.parameters['project'] = 'Proj name'
obj.settings['token'] = '123'
obj.settings['browser-open'] = 'none'
obj.engine = EngineEmul()
shutil.copy(__file__, obj.engine.artifacts_dir + os.path.basename(__file__))
obj.client = client
obj.prepare()
obj.startup()
for x in range(0, 31):
obj.aggregated_second(random_datapoint(x))
mon = [{"ts": 1, "source": "local", "cpu": 1, "mem": 2, "bytes-recv": 100, "other": 0}]
obj.monitoring_data(mon)
obj.check()
for x in range(32, 65):
obj.aggregated_second(random_datapoint(x))
try:
obj.check()
self.fail()
except KeyboardInterrupt:
pass
obj.aggregated_second(random_datapoint(10))
obj.shutdown()
obj.post_process()
开发者ID:azweb76,项目名称:taurus,代码行数:51,代码来源:test_blazeMeterUploader.py
示例3: test_within
def test_within(self):
obj = PassFailStatus()
obj.engine = EngineEmul()
obj.parameters = {"criteria": [
"fail>10% within 5s",
"fail>1000 within 5s",
"avg-rt>100ms within 10s",
]}
obj.prepare()
start_time = time.time()
for _n in range(0, 20):
point = random_datapoint(start_time)
obj.aggregated_second(point)
if _n % 2 == 0:
try:
obj.check()
except KeyboardInterrupt:
pass
try:
obj.check()
except KeyboardInterrupt:
pass
start_time += 1
开发者ID:PurdyForks,项目名称:taurus,代码行数:25,代码来源:test_passFailStatus.py
示例4: test_some_errors
def test_some_errors(self):
client = BlazeMeterClientEmul(logging.getLogger(''))
client.results.append({"marker": "ping", 'result': {}})
client.results.append({"marker": "projects", 'result': []})
client.results.append({"marker": "project-create", 'result': {
"id": time.time(),
"name": "boo",
"userId": time.time(),
"description": None,
"created": time.time(),
"updated": time.time(),
"organizationId": None
}})
client.results.append({"marker": "tests", 'result': {}})
client.results.append({"marker": "test-create", 'result': {'id': 'unittest1'}})
client.results.append(
{"marker": "sess-start",
"result": {
'session': {'id': 'sess1', 'userId': 1},
'master': {'id': 'master1', 'userId': 1},
'signature': ''}})
client.results.append({"marker": "post-proc push", 'result': {'session': {}}})
client.results.append({"marker": "upload1", "result": True}) # post-proc error stats
client.results.append({"marker": "terminate", 'result': {'session': {}}})
client.results.append({"marker": "terminate2", 'result': {'session': {}}})
client.results.append({"marker": "sess-e", "result": {'session': {'id': 'sess1', 'note': 'n'}}})
client.results.append({"marker": "sess-e", "result": {'session': {}}})
client.results.append({"marker": "sess-e", "result": {'master': {'id': 'sess1', 'note': 'n'}}})
client.results.append({"marker": "sess-e", "result": {'master': {}}})
client.results.append({"marker": "upload-file", "result": {}})
obj = BlazeMeterUploader()
obj.parameters['project'] = 'Proj name'
obj.settings['token'] = '123'
obj.settings['browser-open'] = 'none'
obj.engine = EngineEmul()
obj.client = client
obj.prepare()
obj.startup()
obj.engine.stopping_reason = ValueError('wrong value')
obj.aggregated_second(random_datapoint(10))
obj.kpi_buffer[-1][DataPoint.CURRENT][''][KPISet.ERRORS] = [
{'msg': 'Forbidden', 'cnt': 10, 'type': KPISet.ERRTYPE_ASSERT, 'urls': [], KPISet.RESP_CODES: '111'},
{'msg': 'Allowed', 'cnt': 20, 'type': KPISet.ERRTYPE_ERROR, 'urls': [], KPISet.RESP_CODES: '222'}]
obj.post_process()
self.assertEqual(0, len(client.results))
data = json.loads(client.requests[6]['data'])
self.assertEqual(1, len(data['labels']))
total_item = data['labels'][0]
self.assertEqual('ALL', total_item['name'])
self.assertEqual(total_item['assertions'], [{
'failureMessage': 'Forbidden',
'failures': 10,
'name': 'All Assertions'}])
self.assertEqual(total_item['errors'], [{
'm': 'Allowed',
'count': 20,
'rc': '222'}])
开发者ID:PurdyForks,项目名称:taurus,代码行数:58,代码来源:test_blazeMeterUploader.py
示例5: test_prepare2
def test_prepare2(self):
self.configure({"criteria": ["avg-rt>10ms, continue as non-failed"]})
self.obj.prepare()
self.assertGreater(len(self.obj.criteria), 0)
for n in range(0, 10):
point = random_datapoint(n)
self.obj.aggregated_second(point)
self.obj.check()
self.obj.post_process()
开发者ID:andy7i,项目名称:taurus,代码行数:11,代码来源:test_passFailStatus.py
示例6: test_prepare3
def test_prepare3(self):
self.configure({"criteria": ["avg-rt>10ms for 3s, continue as failed"]})
self.obj.prepare()
self.assertGreater(len(self.obj.criteria), 0)
for n in range(0, 10):
point = random_datapoint(n)
point[DataPoint.CURRENT][''][KPISet.AVG_RESP_TIME] = 1
self.obj.aggregated_second(point)
self.obj.check()
self.assertRaises(AutomatedShutdown, self.obj.post_process)
开发者ID:andy7i,项目名称:taurus,代码行数:12,代码来源:test_passFailStatus.py
示例7: test_long_kpi
def test_long_kpi(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({"dump-xml": obj.engine.create_artifact("status", ".xml")})
datapoint = random_datapoint(time.time())
datapoint[datapoint.CUMULATIVE][""]["stdev_rt"] = long(0)
obj.aggregated_second(datapoint)
obj.startup()
obj.shutdown()
obj.post_process()
开发者ID:andy7i,项目名称:taurus,代码行数:12,代码来源:test_FinalStatusReporter.py
示例8: test_prepare2
def test_prepare2(self):
obj = PassFailStatus()
obj.parameters = {"criterias": ["avg-rt>10ms, continue as non-failed"]}
obj.prepare()
self.assertGreater(len(obj.criterias), 0)
for n in range(0, 10):
point = random_datapoint(n)
obj.aggregated_second(point)
obj.check()
obj.post_process()
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:12,代码来源:test_passFailStatus.py
示例9: test_widget
def test_widget(self):
self.configure({"criteria": ["avg-rt>10ms for 2s, continue as failed"]})
self.obj.prepare()
self.obj.get_widget()
start_time = time.time()
for _n in range(0, 10):
point = random_datapoint(start_time + _n)
point[DataPoint.CURRENT]['']["avg_rt"] = 1.0
self.obj.aggregated_second(point)
self.obj.check()
self.assertEqual(self.obj.widget.text_widget.text, "Failed: avg-rt>10ms for 10 sec\n")
开发者ID:andy7i,项目名称:taurus,代码行数:13,代码来源:test_passFailStatus.py
示例10: test_dump
def test_dump(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict()
log_recorder = RecordingHandler()
obj.log.addHandler(log_recorder)
obj.parameters.merge({
"dump-xml": obj.engine.create_artifact("status", ".xml"),
"dump-csv": obj.engine.create_artifact("status", ".csv")
})
obj.aggregated_second(random_datapoint(time.time()))
obj.post_process()
self.assertIn("XML", log_recorder.info_buff.getvalue())
开发者ID:PurdyForks,项目名称:taurus,代码行数:14,代码来源:test_FinalStatusReporter.py
示例11: test_check
def test_check(self):
client = BlazeMeterClientEmul(logging.getLogger(''))
client.results.append({"marker": "ping", 'result': {}})
client.results.append({"marker": "tests", 'result': {}})
client.results.append({"marker": "test-create", 'result': {'id': 'unittest1'}})
client.results.append(
{"marker": "sess-start", 'result': {'session': {'id': 'sess1', 'userId': 1}, 'signature': ''}})
client.results.append({"marker": "first push", 'result': {'session': {}}})
# client.results.append(None) # first check error stats
client.results.append(
{"marker": "second push", 'result': {'session': {"statusCode": 140, 'status': 'ENDED'}}})
# client.results.append(None) # second check error stats
client.results.append({"marker": "post-proc push", 'result': {'session': {}}})
client.results.append({"marker": "upload1", "result": True}) # post-proc error stats
client.results.append({"marker": "terminate", 'result': {'session': {}}})
obj = BlazeMeterUploader()
obj.settings['token'] = '123'
obj.settings['browser-open'] = 'none'
obj.engine = EngineEmul()
shutil.copy(__file__, obj.engine.artifacts_dir + os.path.basename(__file__))
obj.client = client
obj.prepare()
obj.startup()
for x in range(0, 31):
obj.aggregated_second(random_datapoint(x))
obj.check()
for x in range(32, 65):
obj.aggregated_second(random_datapoint(x))
try:
obj.check()
self.fail()
except KeyboardInterrupt:
pass
obj.aggregated_second(random_datapoint(10))
obj.shutdown()
obj.post_process()
开发者ID:dineshkanga,项目名称:taurus,代码行数:37,代码来源:test_blazeMeterUploader.py
示例12: test_dump
def test_dump(self):
obj = FinalStatus()
obj.engine = EngineEmul()
obj.parameters = BetterDict.from_dict({
"dump-xml": obj.engine.create_artifact("status", ".xml"),
"dump-csv": obj.engine.create_artifact("status", ".csv")
})
self.sniff_log(obj.log)
obj.aggregated_second(random_datapoint(time.time()))
obj.startup()
obj.shutdown()
obj.post_process()
self.assertIn("XML", self.log_recorder.info_buff.getvalue())
开发者ID:andy7i,项目名称:taurus,代码行数:15,代码来源:test_FinalStatusReporter.py
示例13: test_percentiles_track
def test_percentiles_track(self):
self.configure({"criteria": ["p90>0ms"]})
self.obj.prepare()
self.assertGreater(len(self.obj.criteria), 0)
for n in range(0, 10):
point = random_datapoint(n)
self.obj.aggregated_second(point)
self.obj.check()
self.obj.shutdown()
try:
self.obj.post_process()
self.fail()
except AutomatedShutdown:
pass
开发者ID:andy7i,项目名称:taurus,代码行数:16,代码来源:test_passFailStatus.py
示例14: test_rc_over1
def test_rc_over1(self):
self.configure({"criteria": [
"rc200<8 over 5s",
]})
self.obj.prepare()
for n in range(0, 10):
point = random_datapoint(n)
rcs = point[DataPoint.CURRENT][''][KPISet.RESP_CODES]
rcs['200'] = 3
self.obj.aggregated_second(point)
self.obj.check()
self.assertFalse(self.obj.criteria[0].is_triggered)
self.obj.shutdown()
self.obj.post_process()
开发者ID:andy7i,项目名称:taurus,代码行数:17,代码来源:test_passFailStatus.py
示例15: test_prepare3
def test_prepare3(self):
obj = PassFailStatus()
obj.parameters = {"criterias": ["avg-rt>10ms for 3s, continue as failed"]}
obj.prepare()
self.assertGreater(len(obj.criterias), 0)
for n in range(0, 10):
point = random_datapoint(n)
point[DataPoint.CURRENT][''][KPISet.AVG_RESP_TIME] = 1
obj.aggregated_second(point)
obj.check()
try:
obj.post_process()
self.fail()
except AutomatedShutdown:
pass
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:17,代码来源:test_passFailStatus.py
示例16: test_cumulative_criteria_post_process
def test_cumulative_criteria_post_process(self):
self.configure({"criteria": [
"p90>0ms, continue as failed",
"avg-rt>0ms, continue as failed",
]})
self.obj.prepare()
self.assertEquals(len(self.obj.criteria), 2)
for n in range(0, 10):
point = random_datapoint(n)
self.obj.aggregated_second(point)
self.obj.check()
self.obj.shutdown()
self.assertRaises(AutomatedShutdown, self.obj.post_process)
for crit in self.obj.criteria:
self.assertTrue(crit.is_triggered)
开发者ID:andy7i,项目名称:taurus,代码行数:17,代码来源:test_passFailStatus.py
示例17: test_within
def test_within(self):
obj = PassFailStatus()
obj.parameters = {"criterias": [
"fail>10% within 5s",
"fail>1000 within 5s",
"avg-rt>100ms within 10s",
]}
obj.prepare()
start_time = time.time()
for _n in range(0, 20):
point = random_datapoint(start_time)
obj.aggregated_second(point)
if _n % 2 == 0:
obj.check()
obj.check()
start_time += 1
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:17,代码来源:test_passFailStatus.py
示例18: test_some_errors
def test_some_errors(self):
client = BlazeMeterClientEmul(logging.getLogger(''))
client.results.append({"marker": "ping", 'result': {}})
client.results.append({"marker": "projects", 'result': []})
client.results.append({"marker": "project-create", 'result': {
"id": time.time(),
"name": "boo",
"userId": time.time(),
"description": None,
"created": time.time(),
"updated": time.time(),
"organizationId": None
}})
client.results.append({"marker": "tests", 'result': {}})
client.results.append({"marker": "test-create", 'result': {'id': 'unittest1'}})
client.results.append(
{"marker": "sess-start",
"result": {
'session': {'id': 'sess1', 'userId': 1},
'master': {'id': 'master1', 'userId': 1},
'signature': ''}})
client.results.append({"marker": "post-proc push", 'result': {'session': {}}})
client.results.append({"marker": "upload1", "result": True}) # post-proc error stats
client.results.append({"marker": "terminate", 'result': {'session': {}}})
client.results.append({"marker": "terminate2", 'result': {'session': {}}})
client.results.append({"marker": "sess-e", "result": {'session': {'id': 'sess1', 'note': 'n'}}})
client.results.append({"marker": "sess-e", "result": {'session': {}}})
client.results.append({"marker": "sess-e", "result": {'master': {'id': 'sess1', 'note': 'n'}}})
client.results.append({"marker": "sess-e", "result": {'master': {}}})
client.results.append({"marker": "upload-file", "result": {}})
obj = BlazeMeterUploader()
obj.parameters['project'] = 'Proj name'
obj.settings['token'] = '123'
obj.settings['browser-open'] = 'none'
obj.engine = EngineEmul()
obj.client = client
obj.prepare()
obj.startup()
obj.engine.stopping_reason = ValueError('wrong value')
obj.aggregated_second(random_datapoint(10))
obj.kpi_buffer[-1][DataPoint.CUMULATIVE][''][KPISet.ERRORS] = [
{'msg': 'Forbidden', 'cnt': 7373, 'type': KPISet.ERRTYPE_ASSERT, 'urls': [], KPISet.RESP_CODES: '403'},
{'msg': 'Allowed', 'cnt': 7373, 'type': KPISet.ERRTYPE_ERROR, 'urls': [], KPISet.RESP_CODES: '403'}]
obj.post_process()
开发者ID:dldinternet,项目名称:taurus,代码行数:45,代码来源:test_blazeMeterUploader.py
示例19: test_percentiles_track
def test_percentiles_track(self):
obj = PassFailStatus()
obj.engine = EngineEmul()
obj.parameters = {"criteria": ["p90>0ms"]}
obj.prepare()
self.assertGreater(len(obj.criteria), 0)
for n in range(0, 10):
point = random_datapoint(n)
obj.aggregated_second(point)
obj.check()
obj.shutdown()
try:
obj.post_process()
self.fail()
except AutomatedShutdown:
pass
开发者ID:PurdyForks,项目名称:taurus,代码行数:18,代码来源:test_passFailStatus.py
示例20: test_prepare
def test_prepare(self):
config = json.loads(open(RESOURCES_DIR + "json/passfail.json").read())
self.configure(config['reporting'][0])
self.obj.prepare()
self.assertGreater(len(self.obj.criteria), 0)
for n in range(0, 10):
point = random_datapoint(n)
ROOT_LOGGER.info("%s: %s", n, point)
self.obj.aggregated_second(point)
try:
self.obj.check()
except AutomatedShutdown:
pass
try:
self.obj.post_process()
except AutomatedShutdown:
pass
开发者ID:andy7i,项目名称:taurus,代码行数:19,代码来源:test_passFailStatus.py
注:本文中的tests.random_datapoint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论