No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
30 | 30 | from io import BytesIO |
|
31 | 31 | from ssl import SSLError |
|
32 | 32 | from urllib.error import HTTPError, URLError |
|
33 | + | from time import sleep |
|
33 | 34 | ||
34 | 35 | import requests |
|
35 | 36 | import yaml |
1472 | 1473 | ||
1473 | 1474 | def prepare(self): |
|
1474 | 1475 | reporting = self.engine.config.get(Reporter.REP) |
|
1475 | - | self.validate_passfail = any(reporter.get('module') == 'passfail' for reporter in reporting) |
|
1476 | 1476 | ||
1477 | 1477 | CloudProvisioning.merge_with_blazemeter_config(self) |
|
1478 | 1478 | CloudProvisioning.configure_client(self) |
1542 | 1542 | self.results_reader.log = self.log |
|
1543 | 1543 | self.engine.aggregator.add_underling(self.results_reader) |
|
1544 | 1544 | ||
1545 | + | self.validate_passfail = any(reporter.get('module') == 'passfail' for reporter in reporting) |
|
1546 | + | ||
1547 | + | if self.validate_passfail: |
|
1548 | + | self.router._test.passfail_validate() |
|
1549 | + | timeout = 100 |
|
1550 | + | for i in range(timeout): |
|
1551 | + | validation_result = self.router._test.passfail_validation() |
|
1552 | + | if validation_result: |
|
1553 | + | return |
|
1554 | + | self.log.warning(f"Unsuccessful Passfail validation attempt [{i+1}]. Retrying...") |
|
1555 | + | if i % 10: |
|
1556 | + | self.log.warning("Please keep in mind that validation can take time.") |
|
1557 | + | sleep(1) |
|
1558 | + | self.log.error("Unable get Passfail validation!") |
|
1559 | + | ||
1545 | 1560 | @staticmethod |
|
1546 | 1561 | def _get_other_modules(config): |
|
1547 | 1562 | used_classes = LocalClient.__name__, BlazeMeterUploader.__name__ |
1677 | 1692 | return True |
|
1678 | 1693 | ||
1679 | 1694 | def check(self): |
|
1680 | - | if self.validate_passfail: |
|
1681 | - | self.validate_passfail = not self.router._test.passfail_validation() |
|
1682 | - | ||
1683 | 1695 | if self.detach: |
|
1684 | 1696 | self.log.warning('Detaching Taurus from started test...') |
|
1685 | 1697 | return True |
515 | 515 | res = self._request(url, data=coll, method="PATCH") |
|
516 | 516 | return res['result'] |
|
517 | 517 | ||
518 | + | def passfail_validate(self): |
|
519 | + | url = f"{self.address}/api/v4/tests/{self['id']}/validate" |
|
520 | + | self._request(url, method='POST') |
|
521 | + | ||
518 | 522 | def passfail_validation(self): |
|
519 | 523 | url = f"{self.address}/api/v4/tests/{self['id']}/validations" |
|
520 | 524 | resp = self._request(url, method='GET') |
1928 | 1928 | "reporting": [{"module": "passfail", "criteria": criteria}], |
|
1929 | 1929 | }, |
|
1930 | 1930 | get={ |
|
1931 | - | 'https://some-bzm-link.com/api/v4/tests/1/validations': {'result': [ |
|
1931 | + | 'https://a.blazemeter.com/api/v4/tests/1/validations': {'result': [ |
|
1932 | 1932 | {'status': 100, |
|
1933 | 1933 | 'warnings': ["passfail warning"], |
|
1934 | 1934 | 'fileWarnings': ["passfail file warning"]}]}, |
|
1935 | - | 'https://some-bzm-link.com/api/v4/masters/1/status': {'result': {"status": "CREATED", "progress": 100}}, |
|
1936 | - | 'https://some-bzm-link.com/api/v4/masters/1/sessions': {"result": {"sessions": []}}, |
|
1935 | + | 'https://a.blazemeter.com/api/v4/masters/1/status': {'result': {"status": "CREATED", "progress": 100}}, |
|
1936 | + | 'https://a.blazemeter.com/api/v4/masters/1/sessions': {"result": {"sessions": []}}, |
|
1937 | 1937 | }, |
|
1938 | 1938 | post={ |
|
1939 | - | 'https://some-bzm-link.com/api/v4/tests/1/start': {"result": {"id": 1}}, |
|
1939 | + | 'https://a.blazemeter.com/api/v4/tests/1/start': {"result": {"id": 1}}, |
|
1940 | + | 'https://a.blazemeter.com/api/v4/tests/1/validate': {}, |
|
1940 | 1941 | }, |
|
1941 | 1942 | ) |
|
1942 | 1943 | self.sniff_log(self.obj.log) |
|
1943 | 1944 | ||
1944 | 1945 | self.obj.prepare() |
|
1945 | 1946 | self.assertEqual(self.obj.engine.config['reporting'][0]['criteria'], criteria) |
|
1946 | 1947 | ||
1947 | - | bzm_link = "https://some-bzm-link.com" |
|
1948 | - | self.obj.router._test.address = bzm_link |
|
1949 | 1948 | self.obj.startup() |
|
1950 | 1949 | self.obj.check() |
|
1951 | 1950 |
Learn more Showing 2 files with coverage changes found.
bzt/modules/monitoring.py
tests/unit/modules/test_Siege.py
Files | Coverage |
---|---|
bzt | -0.02% 90.37% |
tests/unit | 0.01% 97.30% |
setup.py | 0.00% |
Project Totals (117 files) | 92.98% |
#1432
9c3812a
1481512
8161286