Skip to content

Commit

Permalink
Merge pull request #33 from cstockton/master
Browse files Browse the repository at this point in the history
fuzzer: call stop(), removing need for check in _end_message
  • Loading branch information
KissPeter committed Mar 4, 2020
2 parents 3d4169d + 76064d7 commit 88993e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
9 changes: 0 additions & 9 deletions apifuzzer/server_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ def __init__(self):
self.logger.info('Logger initialized')
super(OpenApiServerFuzzer, self).__init__()

def _end_message(self):
super(OpenApiServerFuzzer, self)._end_message()
# Sometimes Kitty has stopped the fuzzer before it has finished the work. We can't continue, but can log
self.logger.info('Stop fuzzing session_info: {}'.format(self.session_info.as_dict()))
test_list_str_end = self.session_info.as_dict().get('test_list_str', '0-0').split('-', 1)[1].strip()
if self.session_info.as_dict().get('end_index') != int(test_list_str_end):
self.logger.error('Fuzzer want to exit before the end of the tests')
self._exit_now(None, None)

def _transmit(self, node):
payload = {}
for key in ['url', 'method']:
Expand Down
1 change: 1 addition & 0 deletions fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def run(self):
fuzzer.set_target(target)
fuzzer.set_interface(interface)
fuzzer.start()
fuzzer.stop()


def str2bool(v):
Expand Down
23 changes: 11 additions & 12 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,17 @@ def fuzz(self, api_resources):
Call APIFuzzer with the given api definition
:type api_resources: dict
"""
with pytest.raises(SystemExit):
prog = Fuzzer(api_resources=api_resources,
report_dir=self.report_dir,
test_level=1,
alternate_url=self.test_app_url,
test_result_dst=None,
log_level='Debug',
basic_output=False,
auth_headers={}
)
prog.prepare()
prog.run()
prog = Fuzzer(api_resources=api_resources,
report_dir=self.report_dir,
test_level=1,
alternate_url=self.test_app_url,
test_result_dst=None,
log_level='Debug',
basic_output=False,
auth_headers={}
)
prog.prepare()
prog.run()

def get_last_report_file(self):
self.report_files = os.listdir(self.report_dir)
Expand Down

0 comments on commit 88993e2

Please sign in to comment.