monkey/envs/monkey_zoo/blackbox
VakarisZ 3d97cb3b61 Merge branch 'zt_performance_fixes' into security_performance_fixes
# Conflicts:
#	envs/monkey_zoo/blackbox/test_blackbox.py
#	monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/EventsModal.js
2020-05-12 17:44:24 +03:00
..
analyzers Fixed telemetry performance test logging bugs and improved logging to display only N longest telems instead of all 2020-04-24 16:41:00 +03:00
island_client Merge remote-tracking branch 'upstream/develop' into monkey_telemetry_fabrication 2020-05-07 12:15:43 +03:00
island_configs Updated PERFORMANCE.conf to include all machines and a lot of segmentation tests 2020-05-07 17:12:48 +03:00
log_handlers Added progress bars, optimized imports, fixed bug that happened on big numbers of telems 2020-04-24 13:19:07 +03:00
tests Minor fixes and improvements 2020-05-11 17:58:58 +03:00
utils Added progress bars, optimized imports, fixed bug that happened on big numbers of telems 2020-04-24 13:19:07 +03:00
README.md Improved the dir structure of telem parsing, other minor CR comments fixed 2020-05-11 16:32:18 +03:00
__init__.py Basic skeleton for blackbox script 2019-08-27 15:52:39 +03:00
conftest.py Refactored to run series of tests, improved configurations, file structure 2019-09-11 12:39:28 +03:00
pytest.ini Added module + filename + line number to logs output in Blackbox 2019-10-07 13:49:13 +03:00
requirements.txt Removed unused package requirement 2019-10-03 15:43:18 +03:00
test_blackbox.py Merge branch 'monkey_telemetry_fabrication' into zt_performance_fixes 2020-05-11 16:42:53 +03:00

README.md

Automatic blackbox tests

Prerequisites

  1. Download google sdk: https://cloud.google.com/sdk/docs/
  2. Download service account key for MonkeyZoo project (if you deployed MonkeyZoo via terraform scripts then you already have it). GCP console -> IAM -> service accounts(you can use the same key used to authenticate terraform scripts)
  3. Deploy the relevant branch + complied executables to the Island machine on GCP.

Running the tests

In order to execute the entire test suite, you must know the external IP of the Island machine on GCP. You can find this information in the GCP Console Compute Engine/VM Instances under External IP.

Running in command line

Run the following command:

monkey\envs\monkey_zoo\blackbox>python -m pytest -s --island=35.207.152.72:5000 test_blackbox.py

Running in PyCharm

Configure a PyTest configuration with the additional arguments -s --island=35.207.152.72 on the monkey\envs\monkey_zoo\blackbox.

Running telemetry performance test

To run telemetry performance test follow these steps:

  1. Gather monkey telemetries.
    1. Enable "Export monkey telemetries" in Configuration -> Internal -> Tests if you don't have exported telemetries already.
    2. Run monkey and wait until infection is done.
    3. All telemetries are gathered in monkey/telem_sample
  2. Run telemetry performance test.
    1. Move directory monkey/test_telems to envs/monkey_zoo/blackbox/tests/performance/test_telems
    2. (Optional) Use envs/monkey_zoo/blackbox/tests/performance/utils/telem_parser.py to multiply telemetries gathered.
      1. Run telem_parser.py script with working directory set to monkey\envs\monkey_zoo\blackbox
      2. Pass integer to indicate the multiplier. For example running telem_parser.py 4 will replicate telemetries 4 times.
      3. If you're using pycharm check "Emulate terminal in output console" on debug/run configuraion.
    3. Performance test will run as part of BlackBox tests or you can run it separately by adding -k 'test_telem_performance' option.