Exemplo n.º 1
0
 def test_build_ulimits_with_integers(self):
     self.assertEqual(
         build_ulimits({'nofile': {
             'soft': 10000,
             'hard': 20000
         }}), [{
             'name': 'nofile',
             'soft': 10000,
             'hard': 20000
         }])
     self.assertEqual(
         self.sort_dicts_by_name(
             build_ulimits({
                 'nofile': {
                     'soft': 10000,
                     'hard': 20000
                 },
                 'nproc': {
                     'soft': 65535,
                     'hard': 65535
                 }
             })),
         self.sort_dicts_by_name([{
             'name': 'nofile',
             'soft': 10000,
             'hard': 20000
         }, {
             'name': 'nproc',
             'soft': 65535,
             'hard': 65535
         }]))
Exemplo n.º 2
0
 def test_build_ulimits_with_dicts(self):
     self.assertEqual(build_ulimits(
         {'nofile': 20000}),
         [{'name': 'nofile', 'soft': 20000, 'hard': 20000}])
     self.assertEqual(self.sort_dicts_by_name(build_ulimits(
         {'nofile': 20000, 'nproc': 65535})),
         self.sort_dicts_by_name([{'name': 'nofile', 'soft': 20000, 'hard': 20000},
                                  {'name': 'nproc', 'soft': 65535, 'hard': 65535}]))
Exemplo n.º 3
0
 def test_build_ulimits_with_ints(self):
     ulimits = build_ulimits({'nofile': 20000, 'nproc': 65535})
     expected = [
         {'name': 'nofile', 'soft': 20000, 'hard': 20000},
         {'name': 'nproc', 'soft': 65535, 'hard': 65535}
     ]
     assert sort_by_name(ulimits) == sort_by_name(expected)
Exemplo n.º 4
0
 def test_build_ulimits_with_invalid_options(self):
     self.assertRaises(
         ConfigError,
         lambda: build_ulimits({'nofile': {
             'soft': 10000,
             'hard': 10
         }}))
Exemplo n.º 5
0
 def test_build_ulimits_with_invalid_options(self):
     self.assertRaises(ConfigError, lambda: build_ulimits({'nofile': {'soft': 10000, 'hard': 10}}))