Ejemplo n.º 1
0
 def test_99_cleanup(self):
     """clean up"""
     # remove the configuration RPM from the client
     Util.remove_rpm(CLI, [self.repo_with_mod_groups])
     # remove comps info from MongoDB
     units = ["category", "environment", "group", "langpacks"]
     base_mongo_cmd = "db.units_package_%s.remove({})"
     all_mongo_cmds = [base_mongo_cmd % unit for unit in units]
     shell_cmd = "mongo pulp_database --eval '%s'" % "; ".join(
         all_mongo_cmds)
     Expect.expect_retval(RHUA, shell_cmd)
     # remove repos
     for repo in self.test_repos:
         RHUIManagerCLI.repo_delete(RHUA, repo)
         Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % repo)
     RHUIManagerCLI.repo_delete(RHUA, BIG_REPO)
     RHUIManagerCLI.repo_delete(RHUA, ZIP_REPO)
     # uninstall HAProxy & CDS, forget their keys
     if not getenv("RHUISKIPSETUP"):
         RHUICLI.delete(RHUA, "haproxy", force=True)
         RHUICLI.delete(RHUA, "cds", force=True)
         ConMgr.remove_ssh_keys(RHUA)
     # if running RHEL Beta, destroy the non-Beta repos again
     cmd = "if grep -c Beta /etc/redhat-release; then " \
           "rm -f /etc/yum.repos.d/redhat-rhui.repo; fi"
     Expect.expect_retval(RHUA, cmd)
Ejemplo n.º 2
0
def teardown():
    '''
    announce the end of the test run
    '''
    # also clean up SSH keys left by rhui
    ConMgr.remove_ssh_keys(RHUA, CDS_HOSTNAMES)
    print("*** Finished running %s. *** " % basename(__file__))
Ejemplo n.º 3
0
def test_20_delete_unreachable():
    '''
    add a Load-balancer, make it unreachable, and see if it can still be deleted from the RHUA
    '''
    # for RHBZ#1639996
    status = RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME, unsafe=True)
    nose.tools.ok_(status, msg="unexpected installation status: %s" % status)
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [HA_HOSTNAME])

    Helpers.break_hostname(RHUA, HA_HOSTNAME)

    # delete it
    status = RHUICLI.delete(RHUA, "haproxy", [HA_HOSTNAME], force=True)
    nose.tools.ok_(status, msg="unexpected deletion status: %s" % status)
    # check it
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [])

    Helpers.unbreak_hostname(RHUA)

    # the node remains configured (haproxy)... unconfigure it properly
    # do so by adding and deleting it again
    RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME, unsafe=True)
    RHUICLI.delete(RHUA, "haproxy", [HA_HOSTNAME], force=True)

    # clean up the SSH key
    ConMgr.remove_ssh_keys(RHUA, [HA_HOSTNAME])
Ejemplo n.º 4
0
 def test_99_cleanup(self):
     '''clean up'''
     Expect.expect_retval(CLI, "rhui-set-release --unset")
     Util.remove_rpm(CLI, [self.test_package, CONF_RPM_NAME])
     RHUIManagerCLI.repo_delete(RHUA, self.repo_id)
     Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % CONF_RPM_NAME)
     if not getenv("RHUISKIPSETUP"):
         RHUIManager.remove_rh_certs(RHUA)
         RHUICLI.delete(RHUA, "haproxy", force=True)
         RHUICLI.delete(RHUA, "cds", force=True)
         ConMgr.remove_ssh_keys(RHUA)
Ejemplo n.º 5
0
def test_18_add_safe_unknown_key():
    '''
    try adding the Load-balancer when its SSH key is unknown, without using --unsafe; should fail
    '''
    # for RHBZ#1409460
    # make sure its key is unknown
    ConMgr.remove_ssh_keys(RHUA, [HA_HOSTNAME])
    # try adding the Load-balancer
    status = RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME)
    nose.tools.ok_(not status, msg="unexpected addition status: %s" % status)
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [])
Ejemplo n.º 6
0
def test_18_add_safe_unknown_key():
    '''
    try adding a CDS whose SSH key is unknown, without using --unsafe; should fail
    '''
    # for RHBZ#1409460
    # choose a random CDS hostname from the list
    cds = random.choice(CDS_HOSTNAMES)
    # make sure its key is unknown
    ConMgr.remove_ssh_keys(RHUA, [cds])
    # try adding the CDS
    status = RHUICLI.add(RHUA, "cds", cds)
    nose.tools.ok_(not status,
                   msg="unexpected %s addition status: %s" % (cds, status))
    cds_list = RHUICLI.list(RHUA, "cds")
    nose.tools.eq_(cds_list, [])
Ejemplo n.º 7
0
 def wait_till_pulp_tasks_finish(connection):
     '''
     wait until there are no running Pulp tasks
     '''
     # will be using pulp-admin, which requires you to log in to it
     # if the Pulp user cert has expired, delete it first of all;
     # if the Pulp user cert doesn't exist, use the one from rhui-manager
     # but create the .pulp directory (with the right perms) if it doesn't exist
     try:
         if Util.cert_expired(connection, "~/.pulp/user-cert.pem"):
             Expect.expect_retval(connection, "rm -f ~/.pulp/user-cert.pem")
     except OSError:
         pass
     rhua = ConMgr.get_rhua_hostname()
     Expect.expect_retval(
         connection, "if ! [ -e ~/.pulp/user-cert.pem ]; then " +
         "mkdir -p -m 700 ~/.pulp; " +
         "ln -s ~/.rhui/%s/user.crt ~/.pulp/user-cert.pem; " % rhua +
         "touch /tmp/pulploginhack; " + "fi")
     while connection.recv_exit_status(
             "pulp-admin tasks list | grep -q '^No tasks found'"):
         time.sleep(15)
     Expect.expect_retval(
         connection, "if [ -f /tmp/pulploginhack ]; then " +
         "rm -f ~/.pulp/user-cert.pem /tmp/pulploginhack; " + "fi")
Ejemplo n.º 8
0
def test_19_add_safe_known_key():
    '''
    add and delete the Load-balancer when its SSH key is known, without using --unsafe; should work
    '''
    # for RHBZ#1409460
    # accept the host's SSH key
    ConMgr.add_ssh_keys(RHUA, [HA_HOSTNAME])
    # actually add and delete the host
    status = RHUICLI.add(RHUA, "haproxy", HA_HOSTNAME)
    nose.tools.ok_(status, msg="unexpected addition status: %s" % status)
    hap_list = RHUICLI.list(RHUA, "haproxy")
    nose.tools.eq_(hap_list, [HA_HOSTNAME])
    status = RHUICLI.delete(RHUA, "haproxy", [HA_HOSTNAME], force=True)
    nose.tools.ok_(status, msg="unexpected deletion status: %s" % status)
    # clean up the SSH key
    ConMgr.remove_ssh_keys(RHUA, [HA_HOSTNAME])
Ejemplo n.º 9
0
 def delete(connection, node_type, hostnames="", force=False):
     '''
     Reinstall one or more CDS or HAProxy nodes.
     Return True if the command exited with 0, and False otherwise.
     Note to the caller: Trust no one! Check for yourself if the nodes have really been deleted.
     '''
     _validate_node_type(node_type)
     if not hostnames:
         if node_type == "cds":
             hostnames = ConMgr.get_cds_hostnames()
         elif node_type == "haproxy":
             hostnames = ConMgr.get_haproxy_hostnames()
     cmd = "rhui %s delete %s" % (node_type, " ".join(hostnames))
     if force:
         cmd += " -f"
     return connection.recv_exit_status(cmd, timeout=180) == 0
Ejemplo n.º 10
0
 def test_15_display_container(self):
     '''check detailed information on the RH container'''
     repo_name = Util.safe_pulp_repo_name(self.containers["rh"]["name"])
     RHUIManagerRepo.check_detailed_information(RHUA,
                                                [self.containers["rh"]["displayname"],
                                                 "https://%s/pulp/docker/%s/" % \
                                                 (ConMgr.get_cds_lb_hostname(), repo_name)],
                                                [False],
                                                [True, None, True],
                                                0)
Ejemplo n.º 11
0
def test_19_add_safe_known_key():
    '''
    add and delete a CDS whose SSH key is known, without using --unsafe; should work
    '''
    # for RHBZ#1409460
    # choose a random CDS hostname from the list
    cds = random.choice(CDS_HOSTNAMES)
    # accept the host's SSH key
    ConMgr.add_ssh_keys(RHUA, [cds])
    # actually add and delete the host
    status = RHUICLI.add(RHUA, "cds", cds)
    nose.tools.ok_(status,
                   msg="unexpected %s addition status: %s" % (cds, status))
    cds_list = RHUICLI.list(RHUA, "cds")
    nose.tools.eq_(cds_list, [cds])
    status = RHUICLI.delete(RHUA, "cds", [cds], force=True)
    nose.tools.ok_(status,
                   msg="unexpected %s deletion status: %s" % (cds, status))
    # clean up the SSH key
    ConMgr.remove_ssh_keys(RHUA, [cds])
Ejemplo n.º 12
0
 def test_05_display_info(self):
     '''
        check detailed information on the RH container
     '''
     RHUIManagerRepo.check_detailed_information(RHUA,
                                                [self.container_displayname,
                                                 "https://%s/pulp/docker/%s/" % \
                                                 (ConMgr.get_cds_lb_hostname(),
                                                  self.container_id)],
                                                [False],
                                                [True, None, True],
                                                0)
Ejemplo n.º 13
0
 def add(connection, node_type,
         hostname="", ssh_user=SUDO_USER_NAME, keyfile_path=SUDO_USER_KEY,
         force=False, unsafe=False):
     '''
     Add a CDS or HAProxy node.
     If hostname is empty, ConMgr will be used to determine the default one for the node type
     Return True if the command exited with 0, and False otherwise.
     Note to the caller: Trust no one! Check for yourself if the node has really been added.
     '''
     _validate_node_type(node_type)
     if not hostname:
         if node_type == "cds":
             hostname = ConMgr.get_cds_hostnames()[0]
         elif node_type == "haproxy":
             hostname = ConMgr.get_haproxy_hostnames()[0]
     cmd = "rhui %s add %s %s %s" % (node_type, hostname, ssh_user, keyfile_path)
     if force:
         cmd += " -f"
     if unsafe:
         cmd += " -u"
     return connection.recv_exit_status(cmd, timeout=300) == 0
 def test_15_check_registry_config():
     '''
        check if container registry configuration was modified
     '''
     if AH_EXISTS:
         _, stdout, _ = ATOMIC_CLI.exec_command(
             "cat /etc/containers/registries.conf")
         cfg = pytoml.load(stdout)
         nose.tools.ok_("%s:5000" % ConMgr.get_cds_lb_hostname() in \
                        cfg["registries"]["search"]["registries"],
                        msg="unexpected configuration: %s" % cfg)
     else:
         raise nose.exc.SkipTest("No known Atomic host")
Ejemplo n.º 15
0
 def check_package_url(connection, package, path=""):
     '''
     verify that the package is available from the RHUI (and not from an unwanted repo)
     '''
     # The name of the test package may contain characters which must be escaped in REs.
     # In modern pulp-rpm versions, packages are in .../Packages/<first letter (lowercase)>/,
     # and the URL can be .../os/...NVR or .../os//...NVR, so let's tolerate anything between
     # the path and the package name. The path is optional, though; if you don't know it or
     # don't care about it, call this method with the mandatory arguments only.
     package_escaped = re.escape(package)
     Expect.ping_pong(connection,
                      "yumdownloader --url %s" % package_escaped,
                      "https://%s/pulp/repos/%s.*%s" % \
                      (ConMgr.get_cds_lb_hostname(), path, package_escaped))
Ejemplo n.º 16
0
 def change_user_password(connection, password='******'):
     '''
     Change the password of rhui-manager user
     '''
     rhua = ConMgr.get_rhua_hostname()
     Expect.enter(connection, "p")
     Expect.expect(connection, "Username:"******"New Password:"******"Re-enter Password:"******"Password successfully updated")
     # this action is supposed to log the admin out and thus delete the user cert
     Expect.expect_retval(connection,
                          "test -f /root/.rhui/%s/user.crt" % rhua, 1)
 def test_17_legacy_ca():
     '''
         check for bogus error messages if a legacy CA is used
     '''
     # for RHBZ#1731856
     # get the CA cert from the RHUA and upload it to the CDS
     # the cert is among the extra RHUI files, ie. in the directory also containing custom RPMs
     cds_lb = ConMgr.get_cds_lb_hostname()
     remote_ca_file = join(CUSTOM_RPMS_DIR, LEGACY_CA_FILE)
     local_ca_file = join(TMPDIR, LEGACY_CA_FILE)
     Util.fetch(RHUA, remote_ca_file, local_ca_file)
     Helpers.add_legacy_ca(CDS, local_ca_file)
     # re-fetch repodata on the client to trigger the OID validator on the CDS
     Expect.expect_retval(CLI, "yum clean all ; yum repolist enabled")
     Expect.expect_retval(
         CDS, "egrep 'Cert verification failed against [0-9]+ ca cert' " +
         "/var/log/httpd/%s_error_ssl.log" % cds_lb, 1)
Ejemplo n.º 18
0
    def test_10_check_images(self):
        '''
           check if the container images are now available
        '''
        if not self.cli_supported:
            raise nose.exc.SkipTest("Not supported on RHEL %s" %
                                    self.cli_os_version)

        quay_repo_name = Util.safe_pulp_repo_name(self.container_quay["name"])
        docker_repo_name = Util.safe_pulp_repo_name(
            self.container_docker["name"])

        _, stdout, _ = CLI.exec_command("docker images")
        images = stdout.read().decode().splitlines()
        images_cli = [image.split()[0].split("/")[1] \
                     for image in images if image.startswith(ConMgr.get_cds_lb_hostname())]
        nose.tools.eq_(
            sorted(images_cli),
            sorted([self.container_id, quay_repo_name, docker_repo_name]))
 def test_14_unauthorized_access(self):
     '''
        verify that RHUI repo content cannot be fetched without an entitlement certificate
     '''
     # try HEADing the repodata file for the already added repo
     # the HTTP request must not complete (not even with HTTP 403);
     # it is supposed to raise an SSLError instead
     cds_lb = ConMgr.get_cds_lb_hostname()
     nose.tools.assert_raises(requests.exceptions.SSLError,
                              requests.head,
                              "https://%s/pulp/repos/" % cds_lb +
                              self.yum_repo_path + "/repodata/repomd.xml",
                              verify=False)
     # also check the protected custom repo
     nose.tools.assert_raises(
         requests.exceptions.SSLError,
         requests.head,
         "https://%s/pulp/repos/" % cds_lb +
         "protected/%s/repodata/repomd.xml" % CUSTOM_PATH,
         verify=False)
Ejemplo n.º 20
0
import csv
import logging
from os.path import basename
import subprocess

import nose

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_instance import RHUIManagerInstance

logging.basicConfig(level=logging.DEBUG)

HOSTNAMES = {
    "RHUA": ConMgr.get_rhua_hostname(),
    "CDS": ConMgr.get_cds_hostnames(),
    "HAProxy": ConMgr.get_haproxy_hostnames()
}
PORTS = {"puppet": 8140, "https": 443, "crane": 5000}
PROTOCOL_TEST_CMD = "echo | openssl s_client -%s -connect %s:%s; echo $?"
# these are in fact the s_client options for protocols, just without the dash
PROTOCOLS = {"good": ["tls1_2"], "bad": ["ssl3", "tls1", "tls1_1"]}
RESULTS = {
    "good": "Secure Renegotiation IS supported",
    "bad": "Secure Renegotiation IS NOT supported"
}

# connections to the RHUA and the HAProxy nodes
RHUA = ConMgr.connect()
HAPROXIES = [ConMgr.connect(host) for host in HOSTNAMES["HAProxy"]]
Ejemplo n.º 21
0
from stitches.expect import Expect

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.helpers import Helpers
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_instance import RHUIManagerInstance
from rhui3_tests_lib.sos import Sos

logging.basicConfig(level=logging.DEBUG)

TMPDIR = mkdtemp()
SOSREPORT_LOCATION_RHUA = join(TMPDIR, "sosreport_location_rhua")
SOSREPORT_LOCATION_CDS = join(TMPDIR, "sosreport_location_cds")

CONNECTION_RHUA = RHUA = ConMgr.connect()
CONNECTION_CDS = ConMgr.connect(ConMgr.get_cds_hostnames()[0])

CDS_LB = ConMgr.get_cds_lb_hostname()
WANTED_FILES_RHUA = [
    "/etc/rhui-installer/answers.yaml", "/etc/rhui/rhui-tools.conf",
    "/root/.rhui/rhui.log", "/var/log/kafo/configuration.log",
    "/var/log/rhui-subscription-sync.log"
]
WANTED_FILES_CDS = [
    "/etc/httpd/conf.d/03-crane.conf",
    "/etc/httpd/conf.d/25-%s.conf" % CDS_LB, "/etc/pulp/",
    "/var/log/httpd/%s_access_ssl.log" % CDS_LB,
    "/var/log/httpd/%s_error_ssl.log" % CDS_LB
]
from __future__ import print_function

import logging
from os.path import basename

import nose
import yaml

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_subman import RHUIManagerSubMan
from rhui3_tests_lib.subscription import RHSMRHUI

logging.basicConfig(level=logging.DEBUG)

RHUA = ConMgr.connect()

class TestSubscription(object):
    """class for tests for subscription registration in RHUI"""

    def __init__(self):
        with open("/etc/rhui3_tests/tested_repos.yaml") as configfile:
            doc = yaml.load(configfile)
            self.subscriptions = doc["subscriptions"]

    @staticmethod
    def setup_class():
        """announce the beginning of the test run"""
        print("*** Running %s: *** " % basename(__file__))

    @staticmethod
from __future__ import print_function

from os.path import basename
import re
import socket

import json
import logging
import nose
import requests

from rhui3_tests_lib.conmgr import ConMgr

logging.basicConfig(level=logging.DEBUG)

AH = ConMgr.get_atomic_cli_hostname()
try:
    socket.gethostbyname(AH)
    AH_EXISTS = True
    AH_CON = ConMgr.connect(AH)
    DOC = "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/" + \
          "7/html/release_notes/overview"
except socket.error:
    AH_EXISTS = False
VERSION_STRING = "page-next.*Red Hat Enterprise Linux Atomic Host ([0-9.]*)"


def setup():
    '''
       announce the beginning of the test run
    '''
Ejemplo n.º 24
0
from os.path import basename
import random

import logging
import nose
from stitches.expect import CTRL_C, Expect

from rhui3_tests_lib.conmgr import ConMgr, SUDO_USER_NAME, SUDO_USER_KEY
from rhui3_tests_lib.helpers import Helpers
from rhui3_tests_lib.rhui_cmd import RHUICLI
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.util import Util

logging.basicConfig(level=logging.DEBUG)

CDS_HOSTNAMES = ConMgr.get_cds_hostnames()

RHUA = ConMgr.connect()
CDS = [ConMgr.connect(host) for host in CDS_HOSTNAMES]


def setup():
    '''
    announce the beginning of the test run
    '''
    print("*** Running %s: *** " % basename(__file__))


def test_01_init():
    '''
    log in to RHUI
Ejemplo n.º 25
0
 def add_instance(connection,
                  screen,
                  hostname="",
                  user_name=SUDO_USER_NAME,
                  ssh_key_path=SUDO_USER_KEY,
                  update=False):
     '''
     Register (add) a new CDS or HAProxy instance
     @param hostname instance, or the default value for the screen type as ConMgr knows it
     @param update: Bool; update the cds or hap if it is already tracked or raise an exception
     '''
     if not hostname:
         if screen == "cds":
             hostname = ConMgr.get_cds_hostnames()[0]
         elif screen == "loadbalancers":
             hostname = ConMgr.get_haproxy_hostnames()[0]
         else:
             raise ValueError("hostname not given and screen invalid")
     # first check if the RHUA knows the host's SSH key, because if so, rhui-manager
     # won't ask you to confirm the key
     key_check_cmd = "ssh-keygen -F %s" % hostname
     # check if the host is known
     known_host = connection.recv_exit_status(key_check_cmd) == 0
     # run rhui-manager and add the instance
     RHUIManager.screen(connection, screen)
     Expect.enter(connection, "a")
     Expect.expect(connection, ".*Hostname of the .*instance to register:")
     Expect.enter(connection, hostname)
     state = Expect.expect_list(connection, [ \
         (re.compile(".*Username with SSH access to %s and sudo privileges:.*" % hostname,
                     re.DOTALL), 1),
         (re.compile(r".*instance with that hostname exists.*Continue\?\s+\(y/n\): ",
                     re.DOTALL), 2)
                                            ])
     if state == 2:
         # cds or haproxy of the same hostname is already being tracked
         if not update:
             # but we don't wish to update its config: say no, quit rhui-manager, and raise
             # an exception
             Expect.enter(connection, "n")
             RHUIManager.quit(connection)
             raise InstanceAlreadyExistsError("%s already tracked but update wasn't required" % \
                                              hostname)
         else:
             # we wish to update, send 'y' answer
             Expect.enter(connection, "y")
             # the question about user name comes now
             Expect.expect(
                 connection,
                 "Username with SSH access to %s and sudo privileges:" %
                 hostname)
     # if the execution reaches here, uesername question was already asked
     Expect.enter(connection, user_name)
     Expect.expect(
         connection,
         "Absolute path to an SSH private key to log into %s as ec2-user:"******".*Cannot find file, please enter a valid path.*",
                      re.DOTALL), 1),
          (re.compile(".*Checking that instance ports are reachable.*",
                      re.DOTALL), 2)])
     if state == 1:
         # don't know how to continue with invalid path: raise an exception
         Expect.enter(connection, CTRL_C)
         Expect.enter(connection, "q")
         raise InvalidSshKeyPath(ssh_key_path)
     # all OK
     # if the SSH key is unknown, rhui-manager now asks you to confirm it; say yes
     if not known_host:
         Expect.enter(connection, "y")
     # some installation and configuration through Puppet happens here, let it take its time
     RHUIManager.quit(connection, "The .*was successfully configured.", 180)
Ejemplo n.º 26
0
import logging
import nose
from stitches.expect import Expect
import yaml

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.helpers import Helpers
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_entitlement import RHUIManagerEntitlements
from rhui3_tests_lib.rhuimanager_repo import AlreadyExistsError, RHUIManagerRepo
from rhui3_tests_lib.util import Util

logging.basicConfig(level=logging.DEBUG)

RHUA = ConMgr.connect()
# side channel for hacking
RHUA_2 = ConMgr.connect()

CUSTOM_REPOS = [
    "custom-i386-x86_64", "custom-x86_64-x86_64", "custom-i386-i386"
]
CUSTOM_PATHS = [repo.replace("-", "/") for repo in CUSTOM_REPOS]
CUSTOM_RPMS_DIR = "/tmp/extra_rhui_files"


class TestRepo(object):
    '''
       class for repository manipulation tests
    '''
    def __init__(self):
import yaml

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.helpers import Helpers
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_client import RHUIManagerClient
from rhui3_tests_lib.rhuimanager_entitlement import RHUIManagerEntitlements
from rhui3_tests_lib.rhuimanager_instance import RHUIManagerInstance
from rhui3_tests_lib.rhuimanager_repo import RHUIManagerRepo
from rhui3_tests_lib.rhuimanager_sync import RHUIManagerSync
from rhui3_tests_lib.util import Util

logging.basicConfig(level=logging.DEBUG)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

RHUA = ConMgr.connect()
# To make this script communicate with a client machine different from cli01.example.com, run:
# export RHUICLI=hostname
# in your shell before running this script, replacing "hostname" with the actual client host name.
# This allows for multiple client machines in one stack.
CLI = ConMgr.connect(getenv("RHUICLI", ConMgr.get_cli_hostnames()[0]))
CDS = ConMgr.connect(ConMgr.get_cds_hostnames()[0])

CUSTOM_REPO = "custom-i386-x86_64"
CUSTOM_PATH = CUSTOM_REPO.replace("-", "/")
CUSTOM_RPMS_DIR = "/tmp/extra_rhui_files"

LEGACY_CA_FILE = "legacy_ca.crt"

TMPDIR = mkdtemp()
Ejemplo n.º 28
0
from os.path import basename

import logging
import nose

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.helpers import Helpers
from rhui3_tests_lib.rhui_cmd import RHUICLI
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_instance import RHUIManagerInstance

logging.basicConfig(level=logging.DEBUG)

# check if (at least) two CDS nodes are actually available
CDS_HOSTNAMES = ConMgr.get_cds_hostnames()
CDS2_EXISTS = len(CDS_HOSTNAMES) > 1

HA_HOSTNAME = ConMgr.get_haproxy_hostnames()[0]

RHUA = ConMgr.connect()
HAPROXY = ConMgr.connect(HA_HOSTNAME)


def setup():
    """announce the beginning of the test run"""
    print("*** Running %s: *** " % basename(__file__))


def test_01_login_add_hap():
    """log in to RHUI, add an HAProxy Load-balancer"""
Ejemplo n.º 29
0
def test_99_cleanup():
    """delete the HAProxy Load-balancer"""
    RHUIManagerInstance.delete(RHUA, "loadbalancers", [HA_HOSTNAME])
    # also clean up the SSH keys (if left behind)
    ConMgr.remove_ssh_keys(RHUA)
import pytoml
from stitches.expect import Expect
import yaml

from rhui3_tests_lib.conmgr import ConMgr
from rhui3_tests_lib.rhuimanager import RHUIManager
from rhui3_tests_lib.rhuimanager_client import RHUIManagerClient
from rhui3_tests_lib.rhuimanager_entitlement import RHUIManagerEntitlements
from rhui3_tests_lib.rhuimanager_instance import RHUIManagerInstance
from rhui3_tests_lib.rhuimanager_repo import RHUIManagerRepo
from rhui3_tests_lib.rhuimanager_sync import RHUIManagerSync
from rhui3_tests_lib.util import Util

logging.basicConfig(level=logging.DEBUG)

AH = ConMgr.get_atomic_cli_hostname()
try:
    socket.gethostbyname(AH)
    AH_EXISTS = True
    ATOMIC_CLI = ConMgr.connect(AH)
except socket.error:
    AH_EXISTS = False
RHUA = ConMgr.connect()


class TestClient(object):
    '''
       class for Atomic client tests
    '''
    def __init__(self):
        with open("/etc/rhui3_tests/tested_repos.yaml") as configfile: