Ejemplo n.º 1
0
    def test_get_values_from_destination(self):
        """
        Check that it updates the default values with the destination ones
        """
        _dest_label = '_unittest_destination'
        _dest_spec = {_dest_label:
            {
                'limits':
                    {
                        'cores': 40,
                        'mem': 1000
                    }
            }
        }
        SPECIFICATIONS[_dest_label] = _dest_spec[_dest_label]

        result = {'cores': 40, 'mem': 1000, 'gpus': 0}
        destination = _dest_label

        limits = _get_limits(destination, dest_spec=SPECIFICATIONS)

        self.assertIsInstance(limits['cores'], int)
        self.assertIsInstance(limits['mem'], int)
        self.assertIsInstance(limits['gpus'], int)
        self.assertEqual(limits, result)
Ejemplo n.º 2
0
    def test_defaults(self):
        """
        Test that it pass default values if no specifications
        """
        _dest_label = '_unittest_destination'
        _dest_spec = {_dest_label: {}}
        SPECIFICATIONS[_dest_label] = _dest_spec[_dest_label]

        result = {'cores': 1, 'mem': 4, 'gpus': 0}
        destination = _dest_label

        limits = _get_limits(destination, dest_spec=SPECIFICATIONS)

        self.assertIsInstance(limits['cores'], int)
        self.assertIsInstance(limits['mem'], int)
        self.assertIsInstance(limits['gpus'], int)
        self.assertEqual(limits, result)