Example #1
0
    def testBasic(self):
        #print '++++++++++ DEBUG: starting testBasic'
        if True:
            # put in a code block so that TestReport closed before we validate
            tr = TestReport('/tmp/trtest.log')
    
            mgr = ClusterMgr()
            
            cfg1 = configs.multi_1um_2pm('3.5.1-5')
            cfg1['boxtype'] = 'cal-precise64'
    
            c = mgr.alloc_new('test-report',cfg1,'vagrant')
    
            tr.new_config(c)
                            
            ts = TestSuite('my001','a unit test test suite')
            t = datetime.now()
            res = TestResult( t, t, True)
            tr.new_result(ts, res)
    
            ts = TestSuite('my002','another test suite')
            res = TestResult( t, t, False)
            tr.new_result(ts, res)
            
            mgr.destroy(c)
            # have to explicitly call this to make sure the file is closed
            tr.finish()

        ref_file = '%s/test1-testlog' % os.path.dirname(__file__)
        self.assertTrue( testutils.file_compare(ref_file, '/tmp/trtest.log'))
Example #2
0
    def testBasic(self):
        # turn on unit-test mode so that we don't actually run vagrant commands
        common.props['vmi.vagrantvmi.unit-test'] = True
        
        cfg1 = configs.multi_1um_2pm('3.5.1-5')
        cfg1['boxtype'] = 'cal-precise64'
        cfg2 = configs.multi_1um_2pm('3.5.1-5')
        cfg2['boxtype'] = 'cal-lucid64'
        runlist = [ (cfg1, 'vagrant', tests.basic001()),
                    (cfg2, 'vagrant', tests.basic001()) ]

        mgrfile = '/tmp/%s_test_testmgr.log' % getpass.getuser()
        mgr = TestManager(mgrfile)

        # need to disable real system calls for unit-test
        utils.syscall_cb = mysyscb

        self.assertTrue( mgr.run_all(runlist) )
        self.assertEqual(mgr.test_report().passing(), 6)
        self.assertEqual(mgr.test_report().failing(), 0)
        self.assertEqual(mgr.test_report().total(), 6)
        utils.syscall_cb = None

        os.remove(mgrfile)
Example #3
0
    def testBasicEm(self):
        # turn on unit-test mode so that we don't actually run vagrant commands
        common.props['vmi.vagrantvmi.unit-test'] = True
        
        cfg1 = configs.multi_1um_2pm('4.5.0-1')
        cfg1['boxtype'] = 'cal-precise64'
        cfg1['binary'] = True
        cfg1['em'] = { 'present' : True, 'invm' : True, 'emhost' : 'localhost', 'emport' : 9090, 'boxtype' : 'cal-centos6', 'oamserver_role' : "pm1", "role" : "em1" }
        runlist = [ (cfg1, 'vagrant', tests.basic001()) ]

        mgrfile = '/tmp/%s_test_testmgr.log' % getpass.getuser()
        mgr = TestManager(mgrfile)

        # need to disable real system calls for unit-test
        utils.syscall_cb = mysyscb

        ret = mgr.run_all(runlist)
        self.assertTrue( ret )
        self.assertEqual(mgr.test_report().passing(), 10)
        self.assertEqual(mgr.test_report().failing(), 0)
        self.assertEqual(mgr.test_report().total(), 10)
        utils.syscall_cb = None

        os.remove(mgrfile)