Exemplo n.º 1
0
    def test_capacity_disk_size_successful(self, mock_ssh):
        c = storagecapacity.StorageCapacity(self.scn, self.ctx)

        mock_ssh.SSH().execute.return_value = (0, DISK_SIZE_SAMPLE_OUTPUT, '')
        c.run(self.result)
        expected_result = json.loads(DISK_SIZE_SAMPLE_OUTPUT)
        self.assertEqual(self.result, expected_result)
Exemplo n.º 2
0
    def test_capacity_successful_setup(self, mock_ssh):
        c = storagecapacity.StorageCapacity(self.scn, self.ctx)

        mock_ssh.SSH().execute.return_value = (0, '', '')
        c.setup()
        self.assertIsNotNone(c.client)
        self.assertTrue(c.setup_done)
Exemplo n.º 3
0
    def test_capacity_block_size_successful(self, mock_ssh):
        args = {"options": {'test_type': 'block_size'}}
        c = storagecapacity.StorageCapacity(args, self.ctx)

        mock_ssh.SSH().execute.return_value = (0, BLOCK_SIZE_SAMPLE_OUTPUT, '')
        c.run(self.result)
        expected_result = json.loads(BLOCK_SIZE_SAMPLE_OUTPUT)
        self.assertEqual(self.result, expected_result)
Exemplo n.º 4
0
    def test_capacity_disk_utilization_successful(self, mock_ssh):
        args = {
            "options": {
                'test_type': 'disk_utilization',
                'interval': 1,
                'count': 2
            }
        }
        c = storagecapacity.StorageCapacity(args, self.ctx)

        mock_ssh.SSH().execute.return_value = (0, DISK_UTIL_RAW_OUTPUT, '')
        c.run(self.result)
        expected_result = json.loads(DISK_UTIL_SAMPLE_OUTPUT)
        self.assertEqual(self.result, expected_result)
Exemplo n.º 5
0
    def test_capacity_unsuccessful_script_error(self, mock_ssh):
        c = storagecapacity.StorageCapacity(self.scn, self.ctx)

        mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
        self.assertRaises(RuntimeError, c.run, self.result)