コード例 #1
0
    def test_nodeBooterDomainNameFromDMD(self):
        """Test that we read the correct domainname from the DMD file, the test domain
        should have been created by the test runner"""
        domainName = scatest.getTestDomainName()
        # Test that we don't already have a bound domain
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
        
        nb = Popen("../../control/framework/nodeBooter -D -debug 9 --nopersist", cwd=scatest.getSdrPath(), shell=True)
        
        time.sleep(5)
        # Test that the name exists and is a DomainManager
        domMgr = self._root.resolve(scatest.getDomainMgrURI())._narrow(CF.DomainManager)
        self.assertNotEqual(domMgr, None)

        # Kill the nodebooter
        os.kill(nb.pid, signal.SIGINT)
        time.sleep(5) # Give it time to shutdown
        self.assertEqual(nb.poll(), 0)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
コード例 #2
0
    def test_nodeBooterDomainNameFromDMD(self):
        """Test that we read the correct domainname from the DMD file, the test domain
        should have been created by the test runner"""
        domainName = scatest.getTestDomainName()
        # Test that we don't already have a bound domain
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
        
        nb = Popen("../../control/framework/nodeBooter -D -debug 9 --nopersist", cwd=scatest.getSdrPath(), shell=True)
        domMgr = self.waitDomainManager(scatest.getDomainMgrURI())
        self.assertNotEqual(domMgr, None)

        # Kill the nodebooter
        os.kill(nb.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb.poll() == 0)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
コード例 #3
0
    def test_nodeBooterShutdown(self):
        """Test that nodeBooter correctly cleans up.
        In OSSIE 0.7.4, and possibly before, killing a nodebooter that was running
        a device manager would prevent you from restarting the devicemanager without
        first restarting the domainmanager.  Test that this condition is fixed"""
        #  It is important that these core pieces somewhat work for all the other tests to succeed
        nb1= Popen("../../control/framework/nodeBooter -D --nopersist", cwd=scatest.getSdrPath(), shell=True)
        domainName = scatest.getTestDomainName()

        domMgr = self.waitDomainManager(scatest.getDomainMgrURI())
        self.assertNotEqual(domMgr, None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        nb2 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        self.assertPredicateWithWait(lambda: len(domMgr._get_deviceManagers()) == 1)

        # Wait until the DeviceManager has finished launching its devices
        devMgr = domMgr._get_deviceManagers()[0]
        self.assertPredicateWithWait(lambda: len(devMgr._get_registeredDevices()) == 1)

        os.kill(nb2.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb2.poll() != None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        # Restart the device manager to prove that the shutdown was graceful.
        # In OSSIE 0.7.4 this would fail.
        nb3 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        self.assertPredicateWithWait(lambda: len(domMgr._get_deviceManagers()) == 1)

        # Wait until the DeviceManager has finished launching its devices
        devMgr = domMgr._get_deviceManagers()[0]
        self.assertPredicateWithWait(lambda: len(devMgr._get_registeredDevices()) == 1)

        os.kill(nb3.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb3.poll() != None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        os.kill(nb1.pid, signal.SIGINT)
        self.assertPredicateWithWait(lambda: nb1.poll() != None)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected
コード例 #4
0
    def test_nodeBooterShutdownSIGQUIT(self):
        """Test that nodeBooter correctly cleans up.
        In OSSIE 0.7.4, and possibly before, killing a nodebooter that was running
        a device manager would prevent you from restarting the devicemanager without
        first restarting the domainmanager.  Test that this condition is fixed"""
        #  It is important that these core pieces somewhat work for all the other tests to succeed
        nb1= Popen("../../control/framework/nodeBooter -D -debug 9 --nopersist", cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5) # Give it time to start

        domainName = scatest.getTestDomainName()
        domMgr = self._root.resolve(scatest.getDomainMgrURI())._narrow(CF.DomainManager)
        self.assertNotEqual(domMgr, None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        nb2 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml -debug 9 --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5) # Give it time to start
        self.assertEqual(len(domMgr._get_deviceManagers()), 1)

        os.kill(nb2.pid, signal.SIGQUIT)
        time.sleep(5) # Give it time to shutdown
        self.assertNotEqual(nb2.poll(), None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        # Restart the device manager to prove that the shutdown was graceful.
        # In OSSIE 0.7.4 this would fail.
        nb3 = Popen("../../control/framework/nodeBooter -d /nodes/test_ExecutableDevice_node/DeviceManager.dcd.xml -debug 9 --domainname %s" % domainName, 
            cwd=scatest.getSdrPath(), shell=True)
        time.sleep(5) # Give it time to start
        self.assertEqual(len(domMgr._get_deviceManagers()), 1)

        os.kill(nb3.pid, signal.SIGQUIT)
        time.sleep(5) # Give it time to shutdown
        self.assertNotEqual(nb3.poll(), None)
        self.assertEqual(len(domMgr._get_deviceManagers()), 0)

        os.kill(nb1.pid, signal.SIGQUIT)
        time.sleep(5) # Give it time to shutdown
        self.assertNotEqual(nb1.poll(), None)

        # Test that we cleaned up the name; this should be automatic because
        # the naming context should be empty.
        try:
            domMgr = self._root.resolve(scatest.getDomainMgrURI())
            self.assertEqual(domMgr, None)
        except CosNaming.NamingContext.NotFound:
            pass # This exception is expected