Exemplo n.º 1
0
    def test_process_missing_vo_in_policy(self):
        try:
            glue2shareid = 'GLUE2ShareID=creamtest1_dteam_abc,GLUE2ServiceID=abc,GLUE2GroupID=resource,o=glue'
            ldif = """
dn: %s
GLUE2ShareID: creamtest1_dteam_abc
GLUE2ComputingShareMappingQueue: creamtest1

dn: GLUE2PolicyID=creamtest1_dteam_abc_policy,%s
GLUE2MappingPolicyShareForeignKey: creamtest1_dteam_abc

""" % (glue2shareid, glue2shareid)

            workspace = Workspace(vomap = self.vomap)
            workspace.setLRMSCmd(self._script())
            workspace.setGLUE2StaticFile(ldif)
            
            cfgfile = workspace.getConfigurationFile()
            config = DynSchedUtils.readConfigurationFromFile(cfgfile)
            
            collector = Analyzer.analyze(config, {})
            GLUE2Handler.process(config, collector, DummyOutput())            
            self.fail("No exception detected")

        except GLUE2Handler.GLUE2Exception, glue_error:
            msg = str(glue_error)
            self.assertTrue(msg == "Missing mandatory attribute GLUE2PolicyUserDomainForeignKey")      
Exemplo n.º 2
0
    def test_process_ok(self):

            glue2shareid = 'GLUE2ShareID=creamtest1_dteam_abc,GLUE2ServiceID=abc,GLUE2GroupID=resource,o=glue'
            ldif = """
dn: GLUE2PolicyID=creamtest1_dteam_abc_policy,%s
GLUE2PolicyUserDomainForeignKey: dteam
GLUE2MappingPolicyShareForeignKey: creamtest1_dteam_abc

dn: %s
GLUE2ShareID: creamtest1_dteam_abc
GLUE2ComputingShareMappingQueue: creamtest1
""" % (glue2shareid, glue2shareid)
            
            workspace = Workspace(vomap = self.vomap)
            workspace.setLRMSCmd(self._script())
            workspace.setGLUE2StaticFile(ldif)
            
            cfgfile = workspace.getConfigurationFile()
            config = DynSchedUtils.readConfigurationFromFile(cfgfile)
            
            dOut = DummyOutput()
            collector = Analyzer.analyze(config, {})
            GLUE2Handler.process(config, collector, dOut)
            
            result = dOut.queued[glue2shareid] == 1
            result = result and dOut.running[glue2shareid] == 2
            self.assertTrue(result)
Exemplo n.º 3
0
    def test_process_missing_share(self):
        try:
            ldif = """
dn: GLUE2PolicyID=creamtest1_dteam_abc_policy,GLUE2ShareID=creamtest1_dteam_abc,GLUE2ServiceID=abc,GLUE2GroupID=resource,o=glue
GLUE2PolicyUserDomainForeignKey: dteam
GLUE2MappingPolicyShareForeignKey: creamtest1_dteam_abc

"""
            workspace = Workspace(vomap = self.vomap)
            workspace.setLRMSCmd(self._script())
            workspace.setGLUE2StaticFile(ldif)
            
            cfgfile = workspace.getConfigurationFile()
            config = DynSchedUtils.readConfigurationFromFile(cfgfile)
            
            collector = Analyzer.analyze(config, {})
            GLUE2Handler.process(config, collector, DummyOutput())            
            self.fail("No exception detected")

        except GLUE2Handler.GLUE2Exception, glue_error:
            msg = str(glue_error)
            self.assertTrue(msg.startswith("Invalid foreign key"))