Exemple #1
0
 def testAutooamUtils(self):
     # sometimes we get non-standard package names in the ref area.  Make
     # sure we still handle it
     v = VersionManager()
     v.retrieve('4.0', 'binary', enterprise = False)
     self.assertTrue( os.path.exists( '%s/%s/packages/Calpont/bin/healthcheck' % (v._cachedir,'4.0-0') ), 
                      '%s/%s/packages/Calpont/bin/healthcheck does not exist' % (v._cachedir,'4.0-0') )
     v.retrieve('Latest', 'binary', enterprise = False)
     self.assertTrue( os.path.exists( '%s/%s/packages/Calpont/bin/healthcheck' % (v._cachedir,'9.9-9') ), 
                      '%s/%s/packages/Calpont/bin/healthcheck does not exist' % (v._cachedir,'9.9-9') )
     v.retrieve('4.0.0-1', 'deb', enterprise = False)
     self.assertTrue( os.path.exists( '%s/%s/packages/Calpont/bin/healthcheck' % (v._cachedir,'4.0.0-1') ), 
                      '%s/%s/packages/Calpont/bin/healthcheck does not exist' % (v._cachedir,'4.0.0-1') )
Exemple #2
0
    def testStd(self):
                
        # standard list_available with no type spec
        v = VersionManager()
        self.assertEqual( sorted(v.list_available()), [ '2.2.11-1', '3.5.1-5', '4.0.0-0' ] )
        
        # standard retrieve from reference with no cache
        pfile = v.retrieve('4.0.0-0','deb',enterprise=False)
        self.assertEqual( pfile, '4.0.0-0/packages/infinidb-4.0.0-0.amd64.deb.tar.gz')
        self.assertEqual( v.get_pkg_version(pfile), '4.0.0-0' )
        self.assertEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, pfile)))

        pfile = v.retrieve('4.0.0-0','binary',enterprise=False)
        self.assertEqual( pfile, '4.0.0-0/packages/infinidb-4.0.0-0.x86_64.bin.tar.gz')

        with self.assertRaisesRegexp(Exception,"Unable to locate standard package for version 4.0.0-0, type rpm"):
            v.retrieve('4.0.0-0','rpm',enterprise=False)
Exemple #3
0
    def testDatdup(self):
                
        # standard list_available with no type spec
        v = VersionManager()
        self.assertEqual( sorted(v.list_available()), [ '2.2.11-1', '3.5.1-5', '4.0.0-0' ] )
        
        # standard retrieve from reference with no cache
        pfile = v.retrieve('3.5.1-5','deb',datdup=True)
        self.assertEqual( pfile, '3.5.1-5/packages/calpont-infinidb-datdup-3.5.1-5.x86_64.bin.tar.gz')
        self.assertEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, pfile)))

        pfile = v.retrieve('3.5.1-5','binary',datdup=True)
        self.assertEqual( pfile, '3.5.1-5/packages/calpont-infinidb-datdup-3.5.1-5.x86_64.bin.tar.gz')

        pfile = v.retrieve('3.5.1-5','rpm',datdup=True)
        self.assertEqual( pfile, '3.5.1-5/packages/calpont-datdup-3.5.1-5.x86_64.rpm')

        with self.assertRaisesRegexp(Exception,"Unable to locate datdup package for version 3.5"):
            v.retrieve('3.5','rpm',datdup=True)
Exemple #4
0
def run_upgrade_suite(vers, vmitype, num = None, enterprise = True):
    '''Runs standard set up upgrade tests for version under test.'''
    if common.props['cluster.cluster.use_em_for_dbinstall']:
        raise Exception('run_upgrade_suite does not support cluster.cluster.use_em_for_dbinstall!')
    
    runlist = []
    
    vmgr = VersionManager()
    
    baselist = common.props['testlib.runlists.upgradefrom']
    streams = baselist.split(',')
    for s in streams:
        # if the stream is the same as the version under test
        # then we need to grab the last release on this stream
        minusone = False if not vers.find(s) == 0 else True
        basever = s
        try:
            basever = vmgr.latest_release_vers(s, minusone)
        except:
            # if we get here, we assume that s is a specific version 
            # that the user wants to upgrade from
            pass
        
        if basever and ConfigSpec._version_greaterthan(vers,basever):
            if ConfigSpec._version_greaterthan(basever, '3.5.1-6' ) or \
                ConfigSpec._version_greaterthan('3.0.0-0', basever ):
                # anything between 3.0 and 3.5.1-5 does not support single server 
                # installs because of the postconfigure race issue.
                
                cfg = configs.singlenode(basever)
                cfg['boxtype'] = 'cal-centos58'
                cfg['binary'] = True
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                cfg['em'] = None # guarantee no EM since this is a "legacy" boxtype
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )
    
                cfg = configs.singlenode(basever)
                cfg['boxtype'] = 'cal-debian6'
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                    # will not repeat this comment each time, but we can use the EM
                    # here as long as it is in attach mode and we are on a supported
                    # version
                    cfg['em'] = None
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )
    
                cfg = configs.singlenode(basever)
                cfg['boxtype'] = 'cal-centos6'
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                    cfg['em'] = None
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )
    
                cfg = configs.singlenode(basever)
                cfg['boxtype'] = 'cal-precise64'
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                    cfg['em'] = None
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )

                if ConfigSpec._version_greaterthan(basever, '3.5.1-5' ):
                    # binary install supported after 3.5.1-5
                    cfg = configs.singlenode(basever)
                    cfg['boxtype'] = 'cal-centos6'
                    cfg['idbuser'] = '******'
                    cfg['upgrade'] = vers
                    cfg['enterprise'] = enterprise
                    if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                        cfg['em'] = None
                    runlist.append( (cfg, 'vagrant', tests.upgrade001()) )
                    
        
            if not s == '2.2':
                # not going to support multi-node upgrades from 2.2 because if 
                # differences in the Calpont.xml.  Could support, but would need
                # to switch to using a postconfigure.in on the upgrade run of
                # postconfigure
                cfg = configs.multi_1um_2pm(basever)
                cfg['boxtype'] = 'cal-centos6'
                cfg['binary'] = True
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                    cfg['em'] = None
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )
    
                cfg = configs.multi_2umpm_combo(basever)
                cfg['boxtype'] = 'cal-centos6'
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                    cfg['em'] = None
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )
    
                cfg = configs.multi_1um_2pm(basever)
                cfg['boxtype'] = 'cal-debian6'
                cfg['upgrade'] = vers
                cfg['enterprise'] = enterprise
                if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                    cfg['em'] = None
                runlist.append( (cfg, 'vagrant', tests.upgrade001()) )

                if ConfigSpec._version_greaterthan(basever, '3.5.1-5' ):
                    cfg = configs.multi_2umpm_combo(basever)
                    cfg['boxtype'] = 'cal-precise64'
                    cfg['idbuser'] = '******'
                    cfg['upgrade'] = vers
                    cfg['enterprise'] = enterprise
                    if not ConfigSpec._version_greaterthan(basever, '4.5.1-3' ):
                        cfg['em'] = None
                    runlist.append( (cfg, 'vagrant', tests.upgrade001()) )

    return runlist
Exemple #5
0
    def testBasic(self):        
        
        # standard list_available with no type spec
        v = VersionManager()
        self.assertEqual( sorted(v.list_available()), [ '2.2.11-1', '3.5.1-5', '4.0.0-0' ] )
        
        # standard retrieve from reference with no cache
        pfile = v.retrieve('3.5.1-5','deb')
        self.assertEqual( pfile, '3.5.1-5/packages/calpont-infinidb-ent-3.5.1-5.amd64.deb.tar.gz')
        self.assertEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, pfile)))

        # retrieve again - this time should come from cache
        pfile = v.retrieve('3.5.1-5','deb')
        self.assertEqual( pfile, '3.5.1-5/packages/calpont-infinidb-ent-3.5.1-5.amd64.deb.tar.gz')
        self.assertEqual( v.get_pkg_version(pfile), '3.5.1-5' )
        
        # the 'Latest' directory in reference has a bin file
        self.assertEqual( sorted(v.list_available('binary')), [ '2.2.11-1', '3.5.1-5', '4.0', '4.0.0-0', '4.0.0-1', '4.5.0-1', 'Latest' ] )

        with self.assertRaisesRegexp(Exception,"Unsupported package type notype"):
            v.list_available('notype')

        with self.assertRaisesRegexp(Exception,"Unsupported package type newtype"):
            v.retrieve('3.5.1-5','newtype')
            
        # now create something that will be in cache only
        newpath = '%s/Unit-test/packages' % self._cachepath
        utils.mkdir_p(newpath) 
        os.system('touch %s/calpont-infinidb-ent-19.0.1-1.x86_64.rpm.tar.gz' % newpath)
        self.assertEqual( sorted(v.list_available('rpm')), [ '2.2.11-1', '3.5.1-5', '4.0.0-0', 'Unit-test' ] )

        pfile = v.retrieve('Unit-test','rpm')
        self.assertEqual( pfile, '19.0.1-1/packages/calpont-infinidb-ent-19.0.1-1.x86_64.rpm.tar.gz')
        self.assertEqual( v.get_pkg_version(pfile), '19.0.1-1' )
           
        # not try to retrieve some files that don't exist
        with self.assertRaisesRegexp(Exception,"Unable to locate enterprise package for version Unit-test"):
            v.retrieve('Unit-test','deb')

        with self.assertRaisesRegexp(Exception,"Unable to locate enterprise package for version non-existent"):
            v.retrieve('non-existent','deb')

        with self.assertRaisesRegexp(Exception,"Unable to locate enterprise package for version Latest"):
            v.retrieve('Latest','rpm')

        pfile = v.retrieve('Latest','binary')
        self.assertEqual( pfile, '9.9-9/packages/infinidb-ent-9.9-9.x86_64.bin.tar.gz')
        self.assertEqual( v.get_pkg_version(pfile), '9.9-9' )
        refpath = 'Latest/packages/infinidb-ent-9.9-9.x86_64.bin.tar.gz'
        self.assertEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, refpath)))
        
        # now we want to force a situation where cached and local copies appear out of sync
        os.system('touch %s/%s' % (self._cachepath, pfile))
        self.assertNotEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, refpath)))
        pfile = v.retrieve('Latest','binary')
        self.assertEqual( pfile, '9.9-9/packages/infinidb-ent-9.9-9.x86_64.bin.tar.gz')
        self.assertEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, refpath)))

        pfile = v.retrieve('4.0.0-0','binary')
        self.assertEqual( pfile, '4.0.0-0/packages/infinidb-ent-4.0.0-0.x86_64.bin.tar.gz')
        self.assertEqual( os.path.getmtime('%s/%s' % (self._cachepath, pfile)), 
                          os.path.getmtime('%s/%s' % (self._pkgpath, pfile)))
        self.assertEqual( v.get_pkg_version(pfile), '4.0.0-0' )
Exemple #6
0
 def testNonStdPkg(self):
     # sometimes we get non-standard package names in the ref area.  Make
     # sure we still handle it
     v = VersionManager()
     versions = sorted(v.list_available('deb'),cmp=ConfigSpec._version_cmp)
     self.assertEqual( versions.count('4.0.0-1_old'), 1 )
Exemple #7
0
 def testLatest(self):
     v = VersionManager()
     self.assertEqual( v.latest_release_vers('3.5'), '3.5.1-5' )
     with self.assertRaisesRegexp(Exception,"Latest not in the form of"):
         self.assertEqual( v.latest_release_vers('Latest'), '3.5.1-5' )
     self.assertEqual( v.latest_release_vers('3.5', minusone=True), None )