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"]]


def _check_protocols(hostname, port):
    """helper method to try various protocols on hostname:port"""
    # check allowed protocols
    for protocol in PROTOCOLS["good"]:
        raw_output = subprocess.check_output(PROTOCOL_TEST_CMD %
                                             (protocol, hostname, port),
                                             shell=True,
                                             stderr=subprocess.STDOUT)
        output_lines = raw_output.decode().splitlines()
        # check for the line that indicates a good result
        nose.tools.ok_(RESULTS["good"] in output_lines,
                       msg="s_client didn't print '%s' when using %s with %s:%s" % \
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()
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
    '''
    RHUIManager.initial_run(RHUA)
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
Exemple #5
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):
Exemple #6
0
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"""
    RHUIManager.initial_run(RHUA)
    RHUIManagerInstance.add_instance(RHUA, "loadbalancers")


def test_02_add_first_cds():
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
    '''
    print("*** Running %s: *** " % basename(__file__))


def test_01_check_version():
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 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:
            doc = yaml.load(configfile)

        self.atomic_repo_name = doc["atomic_repo"]["name"]
        self.atomic_repo_remote = doc["atomic_repo"]["remote"]