Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 16, 2018
2 parents a1e8e19 + 56240c3 commit 8f251d3
Show file tree
Hide file tree
Showing 34 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions IM/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Config:
VM_NUM_USE_CTXT_DIST = 30
DELAY_BETWEEN_VM_RETRIES = 5


config = ConfigParser()
config.read([Config.IM_PATH + '/../im.cfg', Config.IM_PATH +
'/../etc/im.cfg', '/etc/im/im.cfg'])
Expand All @@ -128,6 +129,7 @@ class ConfigOpenNebula:
IMAGE_UNAME = ''
TTS_URL = 'https://localhost:8443'


if config.has_section("OpenNebula"):
parse_options(config, 'OpenNebula', ConfigOpenNebula)

Expand Down
1 change: 1 addition & 0 deletions IM/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def table_exists(self, table_name):
else:
return True


try:
class IntegrityError(sqlite.IntegrityError):
""" Class to return IntegrityError independently of the DB used"""
Expand Down
1 change: 1 addition & 0 deletions IM/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def serve_forever_in_thread(self):
self.__thread.daemon = True
self.__thread.start()


if Config.XMLRCP_SSL:
class AsyncSSLXMLRPCServer(ThreadingMixIn, SSLSimpleXMLRPCServer):

Expand Down
1 change: 1 addition & 0 deletions contextualization/ctxt_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ def run(general_conf_file, vm_conf_file):

return res_data['OK']


if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Contextualization Agent.')
parser.add_argument('general', type=str, nargs=1)
Expand Down
1 change: 1 addition & 0 deletions contextualization/ctxt_agent_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ def run(general_conf_file, vm_conf_file, local):

return res_data['OK']


if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Contextualization Agent.')
parser.add_argument('general', type=str, nargs=1)
Expand Down
1 change: 1 addition & 0 deletions im_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def signal_int_handler(signal, frame):
"""
im_stop()


if __name__ == "__main__":
parser = argparse.ArgumentParser(description='IM service')
parser.add_argument('--version', help='Show IM service version.', dest="version",
Expand Down
1 change: 1 addition & 0 deletions scripts/db_1_4_to_1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def complete_data():
vm.cloud_connector = None
vm.inf = None


if __name__ == "__main__":
if not Config.DATA_DB:
sys.stderr.write("No DATA_DB defined in the im.cfg file!!")
Expand Down
1 change: 1 addition & 0 deletions scripts/delete_old_infs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def delete_data_from_db(db_url, date):
sys.stderr.write("ERROR connecting with the database!.")
sys.exit(-1)


if __name__ == "__main__":
if not Config.DATA_DB:
sys.stderr.write("No DATA_DB defined in the im.cfg file!!\n")
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_im.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,6 @@ def test_inf_lifecycle(self):

IM.DestroyInfrastructure(infId, auth0)


if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletions test/integration/QuickTestIM.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,5 +541,6 @@ def test_75_destroy(self):
self.assertTrue(
success, msg="ERROR calling DestroyInfrastructure: " + str(res))


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/integration/TestIM.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,5 +685,6 @@ def test_95_destroy(self):
self.assertTrue(
success, msg="ERROR calling DestroyInfrastructure: " + str(res))


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/integration/TestREST.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,5 +477,6 @@ def test_98_destroy(self):
self.assertEqual(resp.status_code, 200,
msg="ERROR destroying the infrastructure:" + resp.text)


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/integration/TestREST_JSON.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,6 @@ def test_95_destroy(self):
self.assertEqual(resp.status_code, 200,
msg="ERROR destroying the infrastructure:" + resp.text)


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/loadtest/LoadTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def test(num_client):
now = datetime.datetime.now()
print(now, ": End client num: %d" % num_client)


if __name__ == '__main__':
MAX_THREADS = 1
MAX_CLIENTS = 1
Expand Down
1 change: 1 addition & 0 deletions test/loadtest/LoadTestR.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def test(num_client):
now = datetime.datetime.now()
print(now, ": End client num: %d" % num_client)


if __name__ == '__main__':
MAX_THREADS = 1
MAX_CLIENTS = 1
Expand Down
1 change: 1 addition & 0 deletions test/loadtest/LoadTestREST.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def test(num_client):
now = datetime.datetime.now()
print(now, ": End client num: %d" % num_client)


if __name__ == '__main__':
MAX_THREADS = 1
MAX_CLIENTS = 1
Expand Down
1 change: 1 addition & 0 deletions test/loadtest/LoadTestRESTR.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def test(num_client):
now = datetime.datetime.now()
print(now, ": End client num: %d" % num_client)


if __name__ == '__main__':
MAX_THREADS = 1
MAX_CLIENTS = 1
Expand Down
1 change: 1 addition & 0 deletions test/unit/REST.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,5 +779,6 @@ def test_format_output(self, get_media_type):
info = format_output(["1", "2"])
self.assertEqual(info, 'Unsupported Accept Media Types: application/zip')


if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletions test/unit/ServiceRequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,6 @@ def test_version(self, inflist):
req = IM.ServiceRequests.IMBaseRequest.create_request(IM.ServiceRequests.IMBaseRequest.GET_VERSION)
req._call_function()


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/Tosca.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ def test_tosca_get_outputs(self):
'token': 'pass',
'user': 'ubuntu'}})


if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletions test/unit/VMRC.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ def test_list_vm(self, suds_cli):
self.assertEqual(res_radl[0].getValue("disk.0.os.credentials.password"), "pass")
self.assertEqual(res_radl[0].getValue("disk.0.os.credentials.username"), "user")


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/connectors/GCE.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,6 @@ def test_70_get_custom_instance(self):
instance = gce_cloud.get_instance_type(sizes, radl.systems[0])
self.assertEquals(instance.name, "sizenamne")


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/connectors/OpenNebula.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,5 +390,6 @@ def test_80_delete_image(self, sleep, getONEVersion, server_proxy):
self.assertEqual(one_server.one.image.delete.call_args_list[1], call('user:pass', 1))
self.assertNotIn("ERROR", self.log.getvalue(), msg="ERROR found in log: %s" % self.log.getvalue())


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ def test_db(self, mdb_conn):

db.close()


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/onetts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ def test_list_providers(self, ttscli):
self.assertEqual(username, "username", msg="ERROR: getting one auth from TTS, incorrect username.")
self.assertEqual(password, "password", msg="ERROR: getting one auth from TTS, incorrect password.")


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/openid.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ def test_get_token_introspection(self, requests):
self.assertTrue(success)
self.assertEqual(json.loads(token_info), token_info_resp)


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ def test_recipe(self, DataBase):
self.assertEqual(res[0][1], "mod")
self.assertEqual(res[0][2], "gmod")


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ def test_ansible_thread(self):
self.assertIn("changed=2", output.getvalue())
print(output.getvalue())


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/test_ctxt_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,5 +242,6 @@ def test_90_replace_vm_ip(self):
data = f.read()
self.assertIn(" ansible_host=%s ansible_ssh_host=%s \n" % (vm_data['ctxt_ip'], vm_data['ctxt_ip']), data)


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/test_ctxt_agent_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,6 @@ def test_90_replace_vm_ip(self):
self.assertIn(" ansible_host=%s \n" % vm_data['ctxt_ip'], data)
self.assertIn(" ansible_ssh_host=%s \n" % vm_data['ctxt_ip'], data)


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/test_im_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,5 +1210,6 @@ def test_create_async(self):

IM.DestroyInfrastructure(infId, auth0)


if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletions test/unit/timedcall.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ def test_timer(self):
time.sleep(0.1)
self.assertEqual(res, 4)


if __name__ == '__main__':
unittest.main()
2 changes: 2 additions & 0 deletions test/unit/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,7 @@ def test_request_credential(self, requests):

self.assertTrue(success, msg="ERROR: getting credentials: %s." % cred)
self.assertEqual(cred, expected_cred, msg="ERROR: getting credentials: Unexpected credetials.")


if __name__ == '__main__':
unittest.main()
1 change: 1 addition & 0 deletions test/unit/xmlobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@ def test_timed_call(self):
'<MEMORY>512</MEMORY>\n</TEMPLATE>\n')
self.assertEqual(res, expected)


if __name__ == '__main__':
unittest.main()

0 comments on commit 8f251d3

Please sign in to comment.