/opt/imh-python/lib/python3.9/site-packages/libcloud/test/compute
NameSizeModeActions
fixtures/-0755rm
__pycache__/-0755rm
test_abiquo.py209190644editdlrm
test_auroracompute.py21890644editdlrm
test_azure.py222130644editdlrm
test_azure_arm.py305980644editdlrm
test_base.py40730644editdlrm
test_bluebox.py46620644editdlrm
test_brightbox.py157640644editdlrm
test_bsnl.py12830644editdlrm
test_cloudscale.py45400644editdlrm
test_cloudsigma_v1_0.py82980644editdlrm
test_cloudsigma_v2_0.py280230644editdlrm
test_cloudstack.py573990644editdlrm
test_cloudwatt.py13490644editdlrm
test_deployment.py290570644editdlrm
test_digitalocean_v2.py246700644editdlrm
test_dimensiondata_v2_3.py1585010644editdlrm
test_dimensiondata_v2_4.py1637330644editdlrm
test_ec2.py929530644editdlrm
test_ecp.py51110644editdlrm
test_ecs.py477700644editdlrm
test_elasticstack.py110320644editdlrm
test_exoscale.py11470644editdlrm
test_gandi.py146570644editdlrm
test_gce.py1906760644editdlrm
test_gig_g8.py68260644editdlrm
test_gogrid.py114350644editdlrm
test_gridscale.py172080644editdlrm
test_gridspot.py76820644editdlrm
test_hostvirtual.py86780644editdlrm
test_ikoula.py11390644editdlrm
test_indosat.py13110644editdlrm
test_internetsolutions.py13710644editdlrm
test_joyent.py54620644editdlrm
test_kamatera.py102840644editdlrm
test_kili.py15250644editdlrm
test_ktucloud.py45540644editdlrm
test_kubevirt.py83650644editdlrm
test_libvirt_driver.py37300644editdlrm
test_linode.py87780644editdlrm
test_maxihost.py43060644editdlrm
test_medone.py12950644editdlrm
test_nephoscale.py73780644editdlrm
test_ntta.py13230644editdlrm
test_nttcis.py1483800644editdlrm
test_onapp.py61750644editdlrm
test_oneandone.py423880644editdlrm
test_opennebula.py454560644editdlrm
test_openstack.py1251480644editdlrm
test_ovh.py106160644editdlrm
test_packet.py213670644editdlrm
test_profitbricks.py1240390644editdlrm
test_rackspace.py80150644editdlrm
test_rimuhosting.py43000644editdlrm
test_scaleway.py136630644editdlrm
test_softlayer.py125210644editdlrm
test_ssh_client.py242250644editdlrm
test_types.py32020644editdlrm
test_upcloud.py120560644editdlrm
test_vcl.py48210644editdlrm
test_vcloud.py530320644editdlrm
test_voxel.py61290644editdlrm
test_vpsnet.py86480644editdlrm
test_vultr.py65800644editdlrm
__init__.py40770644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/libcloud/test/compute/test_gridspot.py (7682B)
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import unittest from libcloud.utils.py3 import httplib try: import simplejson as json except ImportError: import json from libcloud.common.types import InvalidCredsError from libcloud.compute.drivers.gridspot import GridspotNodeDriver from libcloud.compute.types import NodeState from libcloud.test import MockHttp from libcloud.test.compute import TestCaseMixin from libcloud.test.secrets import GRIDSPOT_PARAMS class GridspotTest(unittest.TestCase, TestCaseMixin): def setUp(self): GridspotNodeDriver.connectionCls.conn_class = GridspotMockHttp GridspotMockHttp.type = None self.driver = GridspotNodeDriver(*GRIDSPOT_PARAMS) def test_invalid_creds(self): """ Tests the error-handling for passing a bad API Key to the Gridspot API """ GridspotMockHttp.type = 'BAD_AUTH' self.assertRaises(InvalidCredsError, self.driver.list_nodes) def test_list_nodes(self): nodes = self.driver.list_nodes() self.assertEqual(len(nodes), 2) running_node = nodes[0] starting_node = nodes[1] self.assertEqual(running_node.id, 'inst_CP2WrQi2WIS4iheyAVkQYw') self.assertEqual(running_node.state, NodeState.RUNNING) self.assertTrue('69.4.239.74' in running_node.public_ips) self.assertEqual(running_node.extra['port'], 62394) self.assertEqual(running_node.extra['vm_ram'], 1429436743) self.assertEqual(running_node.extra['start_state_time'], 1342108905) self.assertEqual(running_node.extra['vm_num_logical_cores'], 8) self.assertEqual(running_node.extra['vm_num_physical_cores'], 4) self.assertEqual(running_node.extra['winning_bid_id'], 'bid_X5xhotGYiGUk7_RmIqVafA') self.assertFalse('ended_state_time' in running_node.extra) self.assertEqual(running_node.extra['running_state_time'], 1342108989) self.assertEqual(starting_node.id, 'inst_CP2WrQi2WIS4iheyAVkQYw2') self.assertEqual(starting_node.state, NodeState.PENDING) self.assertTrue('69.4.239.74' in starting_node.public_ips) self.assertEqual(starting_node.extra['port'], 62395) self.assertEqual(starting_node.extra['vm_ram'], 1429436744) self.assertEqual(starting_node.extra['start_state_time'], 1342108906) self.assertEqual(starting_node.extra['vm_num_logical_cores'], 7) self.assertEqual(starting_node.extra['vm_num_physical_cores'], 5) self.assertEqual(starting_node.extra['winning_bid_id'], 'bid_X5xhotGYiGUk7_RmIqVafA1') self.assertFalse('ended_state_time' in starting_node.extra) self.assertEqual(starting_node.extra['running_state_time'], 1342108990) def test_create_node(self): """ Gridspot does not implement this functionality """ pass def test_destroy_node(self): """ Test destroy_node for Gridspot driver """ node = self.driver.list_nodes()[0] self.assertTrue(self.driver.destroy_node(node)) def test_destroy_node_failure(self): """ Gridspot does not fail a destroy node unless the parameters are bad, in which case it 404s """ pass def test_reboot_node(self): """ Gridspot does not implement this functionality """ pass def test_reboot_node_failure(self): """ Gridspot does not implement this functionality """ pass def test_resize_node(self): """ Gridspot does not implement this functionality """ pass def test_reboot_node_response(self): """ Gridspot does not implement this functionality """ pass def test_list_images_response(self): """ Gridspot does not implement this functionality """ pass def test_create_node_response(self): """ Gridspot does not implement this functionality """ pass def test_destroy_node_response(self): """ Gridspot does not implement this functionality """ pass def test_list_sizes_response(self): """ Gridspot does not implement this functionality """ pass def test_resize_node_failure(self): """ Gridspot does not implement this functionality """ pass def test_list_images(self): """ Gridspot does not implement this functionality """ pass def test_list_sizes(self): """ Gridspot does not implement this functionality """ pass def test_list_locations(self): """ Gridspot does not implement this functionality """ pass def test_list_locations_response(self): """ Gridspot does not implement this functionality """ pass class GridspotMockHttp(MockHttp): def _compute_api_v1_list_instances_BAD_AUTH(self, method, url, body, headers): return (httplib.NOT_FOUND, "", {}, httplib.responses[httplib.NOT_FOUND]) def _compute_api_v1_list_instances(self, method, url, body, headers): body = json.dumps({ "instances": [ { "instance_id": "inst_CP2WrQi2WIS4iheyAVkQYw", "vm_num_logical_cores": 8, "vm_num_physical_cores": 4, "winning_bid_id": "bid_X5xhotGYiGUk7_RmIqVafA", "vm_ram": 1429436743, "start_state_time": 1342108905, "vm_ssh_wan_ip_endpoint": "69.4.239.74:62394", "current_state": "Running", "ended_state_time": "null", "running_state_time": 1342108989 }, { "instance_id": "inst_CP2WrQi2WIS4iheyAVkQYw2", "vm_num_logical_cores": 7, "vm_num_physical_cores": 5, "winning_bid_id": "bid_X5xhotGYiGUk7_RmIqVafA1", "vm_ram": 1429436744, "start_state_time": 1342108906, "vm_ssh_wan_ip_endpoint": "69.4.239.74:62395", "current_state": "Starting", "ended_state_time": "null", "running_state_time": 1342108990 } ], "exception_name": "" }) return (httplib.OK, body, {}, httplib.responses[httplib.OK]) def _compute_api_v1_stop_instance(self, method, url, body, headers): body = json.dumps({"exception_name": ""}) return (httplib.OK, body, {}, httplib.responses[httplib.OK]) if __name__ == '__main__': sys.exit(unittest.main())