Ejemplo n.º 1
0
 def testShutdownValidate(self):
     s = system.Shutdown(30, None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([], None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([30, 40], None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([30, 'reasons'], None)
     s.Validate()
     s = system.Shutdown([10], None)
     s.Validate()
Ejemplo n.º 2
0
    def testShutdown(self, build_info):
        r = system.Shutdown([15, 'reboot for reasons'], build_info)
        with self.assertRaises(system.ShutdownEvent) as evt:
            r.Run()
            self.assertEqual(evt.timeout, '15')
            self.assertEqual(evt.message, 'reboot for reasons')

        r = system.Shutdown([1], build_info)
        with self.assertRaises(system.ShutdownEvent) as evt:
            r.Run()
            self.assertEqual(evt.timeout, '1')
            self.assertEqual(evt.message, 'undefined')
Ejemplo n.º 3
0
    def testShutdown(self, build_info):
        r = system.Shutdown([15, 'reboot for reasons'], build_info)
        with self.assertRaises(system.ShutdownEvent) as evt:
            r.Run()
        ex = evt.exception
        self.assertEqual(ex.timeout, '15')
        self.assertEqual(str(ex), 'reboot for reasons')

        r = system.Shutdown([1], build_info)
        with self.assertRaises(system.ShutdownEvent) as evt:
            r.Run()
        ex = evt.exception
        self.assertEqual(ex.timeout, '1')
        self.assertEqual(str(ex), 'unspecified')
Ejemplo n.º 4
0
 def testShutdownTimeout(self, build_info):
     r = system.Shutdown([1], build_info)
     with self.assertRaises(system.ShutdownEvent) as evt:
         r.Run()
     ex = evt.exception
     self.assertEqual(ex.timeout, '1')
     self.assertEqual(str(ex), 'unspecified')
     self.assertEqual(ex.pop_next, False)
Ejemplo n.º 5
0
 def testShutdownReason(self, build_info):
     r = system.Shutdown([15, 'shutdown for reasons'], build_info)
     with self.assertRaises(system.ShutdownEvent) as evt:
         r.Run()
     ex = evt.exception
     self.assertEqual(ex.timeout, '15')
     self.assertEqual(str(ex), 'shutdown for reasons')
     self.assertEqual(ex.pop_next, False)
Ejemplo n.º 6
0
 def testShutdownValidate(self):
     s = system.Shutdown(True, None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([30, 40], None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([30, 'reasons', 'True'], None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([1, 2, 3, 4], None)
     self.assertRaises(system.ValidationError, s.Validate)
     s = system.Shutdown([30, 'reasons', True], None)
     s.Validate()
     s = system.Shutdown([30, 'reasons'], None)
     s.Validate()
     s = system.Shutdown([10], None)
     s.Validate()