Beispiel #1
0
    def testD_LoadConfigCache(self):
        """
        _LoadConfigCache_

        Actually load the config cache using plain .load()
        Tests to make sure that if we pass in an id field it gets used to load configs
        """

        configCache = ConfigCache(os.environ["COUCHURL"],
                                  couchDBName='config_test')
        configCache.createUserGroup(groupname="testGroup", username='******')
        configCache.setLabel("labelA")
        configCache.save()

        configCache2 = ConfigCache(os.environ["COUCHURL"],
                                   couchDBName='config_test',
                                   id=configCache.getCouchID(),
                                   rev=configCache.getCouchRev())
        configCache2.load()
        self.assertEqual(configCache2.document['owner'], {
            'group': 'testGroup',
            'user': '******'
        })
        self.assertEqual(configCache2.document['description'], {
            'config_desc': None,
            'config_label': 'labelA'
        })
        return
Beispiel #2
0
    def testC_testViews(self):
        """
        _testViews_

        Prototype test for what should be a lot of other tests.
        """
        PSetTweak = "Hello, I am a PSetTweak.  It's nice to meet you."
        attach = "Hello, I am an attachment"

        configCache = ConfigCache(os.environ["COUCHURL"],
                                  couchDBName='config_test')
        configCache.createUserGroup(groupname="testGroup", username='******')
        configCache.setPSetTweaks(PSetTweak=PSetTweak)
        configCache.attachments['attach1'] = attach
        configCache.document['md5_hash'] = "somemd5"
        psetPath = os.path.join(getTestBase(), "WMCore_t/Cache_t/PSet.txt")
        configCache.addConfig(newConfig=psetPath, psetHash=None)
        configCache.save()

        configCache2 = ConfigCache(os.environ["COUCHURL"],
                                   couchDBName='config_test')
        configCache2.document['md5_hash'] = configCache.document['md5_hash']
        configCache2.load()

        self.assertEqual(configCache2.attachments.get('attach1', None), attach)
        configCache2.delete()
        return
Beispiel #3
0
    def testC_testViews(self):
        """
        _testViews_

        Prototype test for what should be a lot of other tests.
        """
        PSetTweak = "Hello, I am a PSetTweak.  It's nice to meet you."
        attach    = "Hello, I am an attachment"

        configCache = ConfigCache(os.environ["COUCHURL"], couchDBName = 'config_test')
        configCache.createUserGroup(groupname = "testGroup", username = '******')
        configCache.setPSetTweaks(PSetTweak = PSetTweak)
        configCache.attachments['attach1'] = attach
        configCache.document['md5_hash'] = "somemd5"
        psetPath = os.path.join(getTestBase(), "WMCore_t/Cache_t/PSet.txt")        
        configCache.addConfig(newConfig = psetPath, psetHash = None)        
        configCache.save()
        
        configCache2 = ConfigCache(os.environ["COUCHURL"], couchDBName = 'config_test')
        configCache2.document['md5_hash'] = configCache.document['md5_hash']
        configCache2.load()
        
        self.assertEqual(configCache2.attachments.get('attach1', None), attach)
        configCache2.delete()
        return
    def __init__(self, **options):
        GeneratorInterface.__init__(self, **options)
        self.couchUrl = options.get("CouchUrl")
        self.couchDBName = options.get("CouchDBName")
        self.couchConfigDoc = options.get("ConfigCacheDoc")

        confCache = ConfigCache(dbURL = self.couchUrl, couchDBName = self.couchDBName, id = self.couchConfigDoc)
        confCache.load()
        seeds = confCache.document[u'pset_tweak_details'][u'process'][u'RandomNumberGeneratorService']
        self.seedTable = []
        for k in seeds.keys():
            if k == u"parameters_" : continue
            self.seedTable.append("process.RandomNumberGeneratorService.%s.initialSeed" % k)
    def __init__(self, **options):
        GeneratorInterface.__init__(self, **options)
        self.couchUrl = options.get("CouchUrl")
        self.couchDBName = options.get("CouchDBName")
        self.couchConfigDoc = options.get("ConfigCacheDoc")

        confCache = ConfigCache(dbURL=self.couchUrl,
                                couchDBName=self.couchDBName,
                                id=self.couchConfigDoc)
        confCache.load()
        seeds = confCache.document[u'pset_tweak_details'][u'process'][
            u'RandomNumberGeneratorService']
        self.seedTable = []
        for k in seeds:
            if k == u"parameters_": continue
            self.seedTable.append(
                "process.RandomNumberGeneratorService.%s.initialSeed" % k)
Beispiel #6
0
    def testD_LoadConfigCache(self):
        """
        _LoadConfigCache_

        Actually load the config cache using plain .load()
        Tests to make sure that if we pass in an id field it gets used to load configs
        """

        configCache = ConfigCache(os.environ["COUCHURL"], couchDBName = 'config_test')
        configCache.createUserGroup(groupname = "testGroup", username = '******')
        configCache.setLabel("labelA")
        configCache.save()

        configCache2 = ConfigCache(os.environ["COUCHURL"], couchDBName = 'config_test',
                                   id = configCache.getCouchID(),
                                   rev = configCache.getCouchRev())
        configCache2.load()
        self.assertEqual(configCache2.document['owner'],
                         {'group': 'testGroup', 'user': '******'})
        self.assertEqual(configCache2.document['description'],
                         {'config_desc': None, 'config_label': 'labelA'})
        return