From 0f5f01c4b14de5bccd9a60faaef64b642c69d8b7 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Tue, 27 Aug 2019 16:23:09 +0300 Subject: [PATCH] Just some more skeleton code --- envs/monkey_zoo/blackbox/config.py | 2 ++ .../blackbox/island_configs/ssh.conf | 1 + envs/monkey_zoo/blackbox/test_blackbox.py | 19 ++++++++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 envs/monkey_zoo/blackbox/config.py create mode 100644 envs/monkey_zoo/blackbox/island_configs/ssh.conf diff --git a/envs/monkey_zoo/blackbox/config.py b/envs/monkey_zoo/blackbox/config.py new file mode 100644 index 000000000..95efd9835 --- /dev/null +++ b/envs/monkey_zoo/blackbox/config.py @@ -0,0 +1,2 @@ +ISLAND_SERVER_ADDRESS = "1.2.3.4" +ISLAND_SERVER_URL_FORMAT = "https://{IP}/{resource}".format(IP=ISLAND_SERVER_ADDRESS) diff --git a/envs/monkey_zoo/blackbox/island_configs/ssh.conf b/envs/monkey_zoo/blackbox/island_configs/ssh.conf new file mode 100644 index 000000000..db656bbd5 --- /dev/null +++ b/envs/monkey_zoo/blackbox/island_configs/ssh.conf @@ -0,0 +1 @@ +THIS IS AN EXAMPLE FILE. diff --git a/envs/monkey_zoo/blackbox/test_blackbox.py b/envs/monkey_zoo/blackbox/test_blackbox.py index 6cb0e5346..ed20ffd39 100644 --- a/envs/monkey_zoo/blackbox/test_blackbox.py +++ b/envs/monkey_zoo/blackbox/test_blackbox.py @@ -1,6 +1,9 @@ -import pytest import unittest +import requests + +from config import * + class TestMonkeyBlackbox(unittest.TestCase): @classmethod @@ -11,5 +14,15 @@ class TestMonkeyBlackbox(unittest.TestCase): def tearDownClass(cls): print("Killing all GCP machines...") - def test_1_plus_1(self): - assert 1 + 1 == 2 + def generic_blackbox_test_case(self, config_file_path, analyzers): + self.load_config_into_server(config_file_path) + self.run_local_monkey_on_island() + for analyzer in analyzers: + assert analyzer.analyze_test_results() + + def load_config_into_server(self, config_file_path): + print("uploading {} to {}".format(config_file_path, ISLAND_SERVER_ADDRESS)) + + def run_local_monkey_on_island(self): + print("Trying to run local monkey on {}".format(ISLAND_SERVER_ADDRESS)) + print(requests.get(ISLAND_SERVER_URL_FORMAT.format(resource="api"), verify=False).text)