Esempio n. 1
0
 def setUp(self):
     GridspotNodeDriver.connectionCls.conn_classes = (
         None,
         GridspotMockHttp
     )
     GridspotMockHttp.type = None
     self.driver = GridspotNodeDriver(*GRIDSPOT_PARAMS)
Esempio n. 2
0
 def setUp(self):
     GridspotNodeDriver.connectionCls.conn_class = GridspotMockHttp
     GridspotMockHttp.type = None
     self.driver = GridspotNodeDriver(*GRIDSPOT_PARAMS)
Esempio n. 3
0
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
Esempio n. 4
0
class GridspotTest(unittest.TestCase, TestCaseMixin):

    def setUp(self):
        GridspotNodeDriver.connectionCls.conn_classes = (
            None,
            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