Ejemplo n.º 1
0
def init_test(total_tests, config=None, hostname=None, build=None):
    isinstance(config, dict)
    VasTestCase.totalTests = total_tests
    VasTestCase.version = build
    VasTestCase.logger = logging.getLogger(hostname)
    
    if config.has_key("usesite"):
        VasTestCase.useSite = config["usesite"]
    else:
        VasTestCase.useSite = False
        
    osinfo = eval(config.get('osinfo', "{}"))

    # Domains
    VasTestCase.domain = config.get("domain", "a.sb")
    VasTestCase.crossdomain = config.get("crossdomain", "b.sb")
    VasTestCase.crossforest = config.get("crossforest", "c.sb")
    VasTestCase.schemalessDomain = config.get("schemalessdomain", "d.sb")
    VasTestCase.noqacdomain = config.get("noqacdomain", "e.sb")
    VasTestCase.onewayTrustDomain = config.get("onewaytrustdomain", "g.sb")
    VasTestCase.nowayTrustDomain = config.get("nowaytrustdomain", "l.sb")
    VasTestCase.rodcDomain = config.get("rodc", "r.sb")
    
    VasTestCase.defaultDomain = domain_ext(VasTestCase.domain)
    VasTestCase.crossdomain = domain_ext(VasTestCase.crossdomain)
    VasTestCase.crossforest = domain_ext(VasTestCase.crossforest)
    VasTestCase.schemalessDomain = domain_ext(VasTestCase.schemalessDomain)
    VasTestCase.noqacdomain = domain_ext(VasTestCase.noqacdomain)
    VasTestCase.onewayTrustDomain = domain_ext(VasTestCase.onewayTrustDomain)
    VasTestCase.nowayTrustDomain = domain_ext(VasTestCase.nowayTrustDomain)
    VasTestCase.rodcDomain = domain_ext(VasTestCase.rodcDomain)

    # Windows user
    VasTestCase.winUser = config.get("winuser", "Administrator")
    VasTestCase.winPasswd = config.get("winpasswd", "Omega3butter")
    VasTestCase.domainAdmin = User("{}@{}".format(VasTestCase.winUser, VasTestCase.domain), VasTestCase.winPasswd)
    
    VasTestCase.previousBuild = config.get("previousVersion", "4.0.3.184")
    VasTestCase.loginuserpasswd = config.get("loginuserpasswd", "test123")
    username = config.get("username", "root")
    password = config.get("password", "test123")

    VasTestCase.upnMode = config.get("upnmode", False)
    VasTestCase.mount = config.get("mount", True)
    
    # Test Group 
    VasTestCase.testgroup = config.get("testgroup", "QAS - {}".format(build))
    
    # Create computer
    VasTestCase.computer = create_computer_with_hostname(hostname, username, password, VasComputer, 
                                                         domainAdmin=VasTestCase.domainAdmin, domain=VasTestCase.defaultDomain, 
                                                         prod_version=VasTestCase.version, **osinfo)
    
    assert VasTestCase.computer.is_connected, "Unable to log into {}".format(hostname)
def init_test(config, hostname, build):
    isinstance(config, dict)
    osinfo = eval(config.get('osinfo'))
    pangaeaTestCase.version = build
    pangaeaTestCase.logger = logging.getLogger(hostname)
    pangaeaTestCase.server = config.get("server")
    
    pangaeaTestCase.spath = config.get("scriptpath", "H:\\")
    pangaeaTestCase.drive_letter = config.get("driveletter", "p:")
    pangaeaTestCase.previousBuild = config.get("previousVersion", "5.6.0.040")
    
    # Users
    pangaeaTestCase.winUser = config.get("winuser", "Administrator")
    pangaeaTestCase.winPassword = config.get("winpassword", "test123")
    
    # Domain
    pangaeaTestCase.domain = config.get("domain", "h.qas")
    pangaeaTestCase.defaultDomain = domain_ext(pangaeaTestCase.domain)
    
    # Open connections to test computer and peers 
    if osinfo == {}:
        print "Please add 'osinfo = {'os':'[value]','distro':'[value]','osversion':[value],'arch':'[value]'}' to your ini file"
        connected = False
    else:
        if osinfo["os"] != "Windows":
            pangaeaTestCase.logger.error("Pangaea UI tests will be ran on Windows only")
            connected = False
        else:
            pangaeaTestCase.computer = create_computer_with_hostname(hostname, pangaeaTestCase.winUser, pangaeaTestCase.winPassword, pangaeaComputer, domain=pangaeaTestCase.defaultDomain, **osinfo)
            connected = pangaeaTestCase.computer.is_connected
    assert connected, 'There was a problem trying to connect to computer'
    
    # We need to mount the share 
    #pangaeaTestCase.computer.net_use_map_drive("\\\\slcflsl01.prod.quest.corp\RD-PANGAEA-DEV-BUILD", pangaeaTestCase.drive_letter, auth=True)
    
    # We also need to mount hal because thats where the powershell scripts are located. 
    # Everything is now under this location
    pangaeaTestCase.computer.net_use_map_drive("hal9000.vintela.com:/automation/powershell", pangaeaTestCase.drive_letter)
    
    # Set execution policy 
    pangaeaTestCase.computer.remoteShell.run("Set-ExecutionPolicy bypass -force")
    

    return pangaeaTestCase
Ejemplo n.º 3
0
def init_test(total_tests, config=None, hostname=None, build=None):
    isinstance(config, dict)
    mcuTest.total_tests = total_tests
    mcuTest.logger = logging.getLogger(hostname)
    
    # Web browser 
    mcuTest.remoteWebBrowser = config.get("remotewebbrowser", None)
    mcuTest.browser = config.get("browser", None)
    
    # Computers 
    mcuTest.qpmserver = config.get("qpmserver", None)
    mcuTest.qpmuserver = config.get("qpmuserver", None)
    mcuTest.managedClient = config.get("managedclient", None)
    mcuTest.cliComputer = config.get("cliComputer", None)
    mcuTest.powershellComputer = config.get("powershellcomputer", None)    
    
    # Domain 
    mcuTest.serverPlatform = config.get("serverplatform", "Linux")
    mcuTest.domain = config.get("domain", "h.qas")
    mcuTest.defaultDomain = domain_ext(mcuTest.domain)
    
    # Users
    mcuTest.linuxUser = config.get("linuxUser", "root")
    mcuTest.password = config.get("password", "test123")
    mcuTest.winUser = config.get("winuser", "Administrator")
    mcuTest.winPassword = config.get("winpassword", "test123")
    #mcuTest.server = create_computer_with_hostname(winserver, wu, wp)
    
    # Versions
    mcuTest.version = build
    mcuTest.qasVersion = config.get("qasversion", "4.0.3.92")
    mcuTest.qpm4sVersion = config.get("qpm4sversion", None)
    mcuTest.mcuInstalledjvm = config.get("mcuinstalledjvm","32-bit")
    
    # Logging and debug
    mcuTest.logDirectory = config.get("logdirectory", "/var/www/MCU")
    mcuTest.runWithDebug = config.get("runwithdebug", True)
    shelltype = "powershell"
    
    # Package Location
    mcuTest.packagePath = config.get("packagepath", None)
    
    if mcuTest.runWithDebug == "True":
        mcuTest.runWithDebug = True
    else:
        mcuTest.runWithDebug = False
        
    # Test Group 
    mcuTest.testgroup = config.get("testgroup", "MCU - {}".format(build))
    mcuTest.pkgs_needed_list = []
    
    # Opens the bullseye server connection
    mcuTest.logger.info("\nOpening connection | MCU Server...")
    mcuTest.logger.info("-----------------------------------------------")
    if mcuTest.serverPlatform == "Windows":
        mcuTest.computer = create_computer_with_hostname(hostname, mcuTest.winUser, mcuTest.winPassword, mcuComputer, shelltype, domain=mcuTest.defaultDomain)
    else:
        mcuTest.computer = create_computer_with_hostname(hostname, mcuTest.linuxUser, mcuTest.password, mcuComputer, domain=mcuTest.defaultDomain)
        mcuTest.computer.lock_on_computer()
    
    assert mcuTest.computer.is_connected, 'There was a problem trying to connect to computer'
    mcuTest.pkgs_needed_list.append(mcuTest.computer.os)
    mcuTest.computer.check_and_mount_default_mounts()
    
    # Open the connection to the managed client
    if mcuTest.managedClient != None:
        mcuTest.logger.info("\nOpening connection | managed client...")
        mcuTest.logger.info("-----------------------------------------------")
        mcuTest.mc_computer = create_computer_with_hostname(mcuTest.managedClient, mcuTest.linuxUser, mcuTest.password, mcuComputer, domain=mcuTest.defaultDomain)
        assert mcuTest.mc_computer.is_connected, 'There was a problem trying to connect to the managed client'
        mcuTest.pkgs_needed_list.append(mcuTest.mc_computer.os)    
        mcuTest.mc_computer.check_and_mount_default_mounts()
    
    # If there is a qpm4s and qpm4u server then open connection
    # Open the connection to the qpm server 
    if mcuTest.qpmserver != None:
        mcuTest.logger.info("\nOpening connection | qpm server...")
        mcuTest.logger.info("-----------------------------------------------")
        mcuTest.qpm_computer = create_computer_with_hostname(mcuTest.qpmserver, mcuTest.linuxUser, mcuTest.password, mcuComputer, domain=mcuTest.defaultDomain)
        assert mcuTest.qpm_computer.is_connected, 'There was a problem trying to connect to the qpm server'
        mcuTest.pkgs_needed_list.append(mcuTest.qpm_computer.os) 
        mcuTest.qpm_computer.check_and_mount_default_mounts()
    
    # Open the connection to qpm4u server
    if mcuTest.qpmuserver != None:
        mcuTest.logger.info("\nOpening connection | qpm4u server...")
        mcuTest.logger.info("-----------------------------------------------")
        mcuTest.qpm4u_computer = create_computer_with_hostname(mcuTest.qpmuserver, mcuTest.linuxUser, mcuTest.password, mcuComputer, domain=mcuTest.defaultDomain)
        assert mcuTest.qpm4u_computer.is_connected, 'There was a problem trying to connect to the qpm4u server'
        mcuTest.pkgs_needed_list.append(mcuTest.qpm4u_computer.os)
        mcuTest.qpm4u_computer.check_and_mount_default_mounts()
        
    # Open a web browser for testing
    if mcuTest.browser != None:
        mcuTest.logger.info("\nOpening up internet browser | {}".format(mcuTest.browser))
        mcuTest.logger.info("-----------------------------------------------")
        mcuTest.mcuConsole = pagehandler.mcuPage.mcuPage(mcuTest.remoteWebBrowser, mcuTest.computer.hostname, mcuTest.browser, mcuTest.logDirectory, mcuTest.logger, mcuTest.version)
        assert mcuTest.mcuConsole.page != None, 'Did not open a browser'
        mcuTest.webdriverVersion = selenium.__version__
        
    # Get the most current version of qpm4s
    if mcuTest.qpm4sVersion == None:
        version, qpmBuild = mcu.getLatestVersion("qpm4s")
        mcuTest.qpm4sVersion = version + "." + qpmBuild
        
    host = "%-15s \t%-1s" % ("Test Computer:", hostname)
    mc = "%-15s \t%-1s" % ("Managed Client:", mcuTest.managedClient)
    qs = "%-15s \t%-1s" % ("qpm_computer:", mcuTest.qpmserver)
    qu = "%-15s \t%-1s" % ("qpm4u_computer:", mcuTest.qpmuserver)
    mcv = "%-15s \t%-1s" % ("MCU Version:", mcuTest.version)
    if mcuTest.browser != None:
        br = "%-15s \t%-1s" % ("Browser Name:", mcuTest.mcuConsole.page.capabilities['browserName'])
        bv = "%-15s \t%-1s" % ("Browser Version:", mcuTest.mcuConsole.page.capabilities['version'])
        bl = "%-15s \t%-1s" % ("Browser Location:", mcuTest.remoteWebBrowser)
        wv = "%-15s \t%-1s" % ("Webdriver Version:", mcuTest.webdriverVersion)
        mcuTest.test_information = "{} \n{} \n{} \n{} \n{} \n{} \n{} \n{} \n{}".format(host, mc, qs, qu, mcv, br, bv, bl, wv)
    else:
        mcuTest.test_information = "{} \n{} \n{} \n{} \n{}".format(host, mc, qs, qu, mcv)
    
    mcuTest.computer.logger.info("\n--------------------------------------------------")
    mcuTest.computer.logger.info("                 Test Information                   ")
    mcuTest.computer.logger.info("--------------------------------------------------")  
    mcuTest.computer.logger.info(mcuTest.test_information)
    mcuTest.computer.logger.info("--------------------------------------------------") 
    
    return mcuTest
def init_test(total_tests, config, hostname, build):
    
    isinstance(config, dict)
    integrationTestCase.version = build
    
    integrationTestCase.total_tests = total_tests
    
    # Web browser 
    integrationTestCase.remoteWebBrowser = config.get("remotewebbrowser", None)
    integrationTestCase.browser = config.get("browser", None)
    
    # MCU Computers 
    integrationTestCase.managedClient = config.get("managedclient", None)
    
    # QPM Computers
    integrationTestCase.qpms_server = config.get("qpmserver", None)
    integrationTestCase.qpmu_server = config.get("qpmuserver", None)
    
    # QAS Computer
    integrationTestCase.qas_computer = config.get("qascomputer", None)  
    
    # Users
    integrationTestCase.linuxUser = config.get("linuxUser", "root")
    integrationTestCase.password = config.get("password", "test123")
    integrationTestCase.winUser = config.get("winuser", "Administrator")
    integrationTestCase.loginuserpasswd = config.get("loginuserpasswd", "test123")
    integrationTestCase.winPassword = config.get("winpassword", "test123")
    username = config.get("username", "root")
    password = config.get("password", "test123")
    
    integrationTestCase.logger = logging.getLogger(hostname)
    integrationTestCase.spath = config.get("scriptpath","/mnt/qpm4u/smoke/")
    integrationTestCase.previousBuild = config.get("previousVersion", "5.6.0.040")
    integrationTestCase.devb = config.get("devb", "/mnt/qpm4u/dev-builds")
    
    # QAS Stuff
    integrationTestCase.upnMode = config.get("upnmode", False)
    integrationTestCase.mount = config.get("mount", True)
    
    # Test Group 
    integrationTestCase.testgroup = config.get("testgroup", "Integration - {}".format(build))
    
    # Logging and debug
    integrationTestCase.logDirectory = config.get("logdirectory", "/var/www/MCU")
    integrationTestCase.runWithDebug = config.get("runwithdebug", True)
    
    # Domain
    integrationTestCase.domain = config.get("domain", "h.qas")
    integrationTestCase.defaultDomain = domain_ext(integrationTestCase.domain)
    
    # install Path
    integrationTestCase.install_sh_path = config.get("installshpath", "/mnt/integratedIso/dev-builds")
    integrationTestCase.install_sh_build_path = "{}/{}".format(integrationTestCase.install_sh_path, integrationTestCase.version)
    integrationTestCase.mcuInstalledjvm = config.get("mcuinstalledjvm","32-bit")
    
    computer_list = []
    computer_list.append(hostname)
    computer_list.append(config.get("qpmserver"))
    computer_list.append(config.get("qpmuserver"))
    computer_list.append(config.get("qascomputer"))
    
    sorted_list = set(computer_list)
    mcu_comp = False
    qas_comp = False
    qpms_comp = False
    qpmu_comp = None
    
    # Find out what computers we have
    integrationTestCase.open_computers = []
    for comp in sorted_list:
        # We should always have at least this computer
        # MCU | Open connections to mcu computers ----------------------------------------------------------------------
        if comp == hostname:
            mcu_comp = hostname
            integrationTestCase.mcu_computer = _open_and_setup_computer(mcu_comp, username, password, integrationComputer, integrationTestCase.defaultDomain)
            
        # QPM4S | Open connections to QPM4S computer ----------------------------------------------------------------------
        elif comp == config.get("qpmserver"):
            qpms_comp = config.get("qpmserver")
            integrationTestCase.qpms_server = _open_and_setup_computer(qpms_comp, "root", "test123", integrationComputer, integrationTestCase.defaultDomain)
            
        # QPM4U | Open connections to QPM4U computer ----------------------------------------------------------------------
        elif comp == config.get("qpmuserver"):
            qpmu_comp = config.get("qpmuserver")
            integrationTestCase.qpmu_server = _open_and_setup_computer(qpmu_comp, "root", "test123", integrationComputer, integrationTestCase.defaultDomain)
            
        # QAS | Open connections to QPM4U computer ----------------------------------------------------------------------
        elif comp == config.get("qascomputer"):
            qas_comp = config.get("qascomputer")
            integrationTestCase.qas_computer = _open_and_setup_computer(qas_comp, "root", "test123", integrationComputer, integrationTestCase.defaultDomain)
   
    # Now we need to assign other computers that did not get opened 
    if not qas_comp:
        for comp in integrationTestCase.open_computers:        
            if comp.hostname == config.get("qascomputer"):
                integrationTestCase.qas_computer = comp
                break
                
    if not qpms_comp:
        for comp in integrationTestCase.open_computers:        
            if comp.hostname == config.get("qpmserver"):
                integrationTestCase.qpms_server = comp
                break
                
    if not qpmu_comp:
        for comp in integrationTestCase.open_computers:        
            if comp.hostname == config.get("qpmuserver"):
                integrationTestCase.qpmu_server = comp
                break
            
    # Run this to set the env variables.
    if integrationTestCase.qpms_server.hostname == integrationTestCase.qpmu_server.hostname:        
        # If they are the same computer then we only need to run it once
        set_devb(integrationTestCase.qpmu_server, integrationTestCase.devb)
    else:
        # If they are different then run on each box. 
        set_devb(integrationTestCase.qpms_server, integrationTestCase.devb)
        set_devb(integrationTestCase.qpmu_server, integrationTestCase.devb)


    # WEB Browser | Open a web browser for testing ----------------------------------------------------------------------
    if integrationTestCase.browser != None:
        integrationTestCase.logger.info("\nOpening up internet browser | {}".format(integrationTestCase.browser))
        integrationTestCase.logger.info("-----------------------------------------------")
        integrationTestCase.mcuConsole = pagehandler.mcuPage.mcuPage(integrationTestCase.remoteWebBrowser, integrationTestCase.mcu_computer.hostname, integrationTestCase.browser, integrationTestCase.logDirectory, integrationTestCase.logger, integrationTestCase.version)
        assert integrationTestCase.mcuConsole.page != None, 'Did not open a browser'
        integrationTestCase.webdriverVersion = selenium.__version__

    return integrationComputer
Ejemplo n.º 5
0
def init_test(config, hostname, build):
    isinstance(config, dict)
    QpmTestCase.version = build
    QpmTestCase.logger = logging.getLogger(hostname)
    QpmTestCase.server = config.get("server")
    QpmTestCase.secondary = config.get("secondary")
    QpmTestCase.client = config.get("client")
    QpmTestCase.spath = config.get("scriptpath","/mnt/qpm4u/smoke/")
    QpmTestCase.previousBuild = config.get("previousVersion", "5.6.0.040")
    QpmTestCase.devb = config.get("devb", "/mnt/qpm4u/dev-builds")
    osinfo = eval(config.get('osinfo','{}'))
    serverinfo = eval(config.get('serverinfo'))
    username = config.get("username", "root")
    password = config.get("password", "test123")
    
    # Domain
    QpmTestCase.domain = config.get("domain", "h.qas")
    QpmTestCase.defaultDomain = domain_ext(QpmTestCase.domain)

    # Open connections to test computer and peers 
    QpmTestCase.computer = create_computer_with_hostname(hostname, username, password, QpmComputer, domain=QpmTestCase.defaultDomain, **osinfo)
    assert QpmTestCase.computer.is_connected, 'There was a problem trying to connect to computer'
    
    # Check Mount after opening computer
    QpmTestCase.computer.check_and_mount_custom("hal9000.vintela.com:/automation/packages", "/mnt/packages")
    
    # Lock computer after mounts are setup
    QpmTestCase.computer.lock_on_computer()
    set_devb(QpmTestCase.computer, QpmTestCase.devb)

    # Setup PATH
    run(QpmTestCase.computer, "PATH=$PATH:/opt/quest/bin:/opt/quest/sbin; export PATH");

    # See if testing is using the box 
    dont_smoke = "/tmp/.dont_smoke"
    counter = 0
    while QpmTestCase.computer.fileExists(dont_smoke):
        QpmTestCase.computer.logger.info("There is a lock file from testing: {}".format(dont_smoke))
        if counter % 3600 == 0:
            QpmTestCase.computer.remoteShell.run("echo Please wrap it up so smoke can run. Remove {} | wall".format(dont_smoke))
        
        counter+=120
        if counter % 10800 == 0:
            QpmTestCase.computer.remoteShell.run("rm -f {0}; echo Done waiting, removing file {0}. Smoke will resume in 120 seconds | wall".format(dont_smoke))
        
        time.sleep(120)
        
    QpmTestCase.computer.remoteShell.run("echo QPM4S Smoke has been ordered to run | wall".format(dont_smoke))
            
    QpmTestCase.servercomp = create_computer_with_hostname(username="******", password="******", computerclass=QpmComputer, **serverinfo)
    assert QpmTestCase.servercomp.is_connected, 'There was a problem trying to connect to the computer'
    QpmTestCase.servercomp.check_and_mount_custom("hal9000.vintela.com:/automation/packages", "/mnt/packages")
    
    QpmTestCase.servercomp.lock_on_computer()
    set_devb(QpmTestCase.servercomp, QpmTestCase.devb)

    # Setup PATH
    run(QpmTestCase.servercomp, "PATH=$PATH:/opt/quest/bin:/opt/quest/sbin; export PATH");
    
    # Clean the the server beforehand
    QpmTestCase.logger.info("\n\nCleaning {}. Cleaning off the server, agent and client".format(QpmTestCase.servercomp.hostname))
    QpmTestCase.servercomp.remoteShell.run(QpmTestCase.spath + "clean-server.sh", timeout=500)
    QpmTestCase.servercomp.remoteShell.run(QpmTestCase.spath + "clean-agent.sh", timeout=500)
    QpmTestCase.servercomp.remoteShell.run(QpmTestCase.spath + "clean-client.sh", timeout=500)
    
    # Prep the peers
    QpmTestCase.logger.info("\n\n{} | Installing and configuring server...".format(QpmTestCase.servercomp.hostname))
    QpmTestCase.servercomp.remoteShell.run(QpmTestCase.spath + "install-server.sh {}".format(build), timeout=500)
    QpmTestCase.servercomp.remoteShell.run(QpmTestCase.spath + "config-server-001.sh -f {}".format(QpmTestCase.spath + "sudoers/default"), timeout=500)

    # Cleanup test computer  
    QpmTestCase.logger.info("\n\nCleaning test computer: {}".format(QpmTestCase.computer.hostname))
    QpmTestCase.computer.remoteShell.run(QpmTestCase.spath + "clean-server.sh", timeout=500)
    QpmTestCase.computer.remoteShell.run(QpmTestCase.spath + "clean-client.sh", timeout=500)
    QpmTestCase.computer.remoteShell.run(QpmTestCase.spath + "clean-agent.sh", timeout=500)
    
    return QpmTestCase