Skip to content

Commit

Permalink
Merge branch 'bulk-host-tests' of github.com:sambible/robottelo into …
Browse files Browse the repository at this point in the history
…bulk-host-tests
  • Loading branch information
sambible committed Nov 16, 2023
2 parents 6990126 + 0ef385f commit d89d714
Show file tree
Hide file tree
Showing 21 changed files with 915 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- name: is autoMerging enabled for Auto CherryPicked PRs ?
if: ${{ always() && steps.cherrypick.outcome == 'success' && contains(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') }}
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM fedora
FROM fedora:38
MAINTAINER https://github.com/SatelliteQE

RUN dnf install -y gcc git make cmake libffi-devel openssl-devel python3-devel \
python3-pip redhat-rpm-config which libcurl-devel libxml2-devel

COPY / /robottelo/
WORKDIR /robottelo
RUN curl https://raw.githubusercontent.com/SatelliteQE/broker/master/broker_settings.yaml.example -o broker_settings.yaml

ENV PYCURL_SSL_LIBRARY=openssl
RUN pip install -r requirements.txt
Expand Down
4 changes: 1 addition & 3 deletions conf/broker.yaml.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
BROKER:
# The path where your broker settings and inventory are located
# If you leave it blank, the default is the output of `broker --version`
BROKER_DIRECTORY:
# Broker has its own config which you can find by running `broker --version`
HOST_WORKFLOWS:
POWER_CONTROL: vm-power-operation
EXTEND: extend-vm
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
betelgeuse==1.10.0
broker[docker]==0.4.1
cryptography==41.0.5
deepdiff==6.7.0
deepdiff==6.7.1
dynaconf[vault]==3.2.4
fauxfactory==3.1.0
jinja2==3.1.2
Expand All @@ -13,10 +13,11 @@ productmd==1.37
pyotp==2.9.0
python-box==7.1.1
pytest==7.4.3
pytest-order==1.1.0
pytest-services==2.2.1
pytest-mock==3.12.0
pytest-reportportal==5.3.0
pytest-xdist==3.3.1
pytest-xdist==3.4.0
pytest-ibutsu==2.2.4
PyYAML==6.0.1
requests==2.31.0
Expand Down
10 changes: 8 additions & 2 deletions robottelo/cli/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,13 +1692,19 @@ def setup_org_for_a_custom_repo(options=None):
raise CLIFactoryError(f'Failed to publish new version of content view\n{err.msg}')
# Get the content view info
cv_info = ContentView.info({'id': cv_id})
lce_promoted = cv_info['lifecycle-environments']
assert len(cv_info['versions']) > 0
cv_info['versions'].sort(key=lambda version: version['id'])
cvv = cv_info['versions'][-1]
lce_promoted = cv_info['lifecycle-environments']
# Promote version to next env
try:
if env_id not in [int(lce['id']) for lce in lce_promoted]:
ContentView.version_promote(
{'id': cvv['id'], 'organization-id': org_id, 'to-lifecycle-environment-id': env_id}
{
'id': cvv['id'],
'organization-id': org_id,
'to-lifecycle-environment-id': env_id,
}
)
except CLIReturnCodeError as err:
raise CLIFactoryError(f'Failed to promote version to next environment\n{err.msg}')
Expand Down
9 changes: 0 additions & 9 deletions robottelo/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ def get_settings():


settings = get_settings()


if not os.getenv('BROKER_DIRECTORY'):
# set the BROKER_DIRECTORY envar so broker knows where to operate from
if _broker_dir := settings.robottelo.get('BROKER_DIRECTORY'):
logger.debug(f'Setting BROKER_DIRECTORY to {_broker_dir}')
os.environ['BROKER_DIRECTORY'] = _broker_dir


robottelo_tmp_dir = Path(settings.robottelo.tmp_dir)
robottelo_tmp_dir.mkdir(parents=True, exist_ok=True)

Expand Down
10 changes: 5 additions & 5 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class Colored(Box):
'yum': "yum",
'ostree': "ostree",
'docker': "docker",
'ansible_collection': "ansible collection",
'ansible_collection': "ansible_collection",
'file': "file",
}

Expand Down Expand Up @@ -546,16 +546,16 @@ class Colored(Box):
},
'rhel9_bos': {
'id': 'rhel-9-for-x86_64-baseos-kickstart',
'name': 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS Kickstart 9.2',
'version': '9.2',
'name': 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS Kickstart 9.3',
'version': '9.3',
'reposet': REPOSET['kickstart']['rhel9'],
'product': PRDS['rhel9'],
'distro': 'rhel9',
},
'rhel9_aps': {
'id': 'rhel-9-for-x86_64-appstream-kickstart',
'name': 'Red Hat Enterprise Linux 9 for x86_64 - AppStream Kickstart 9.2',
'version': '9.2',
'name': 'Red Hat Enterprise Linux 9 for x86_64 - AppStream Kickstart 9.3',
'version': '9.3',
'reposet': REPOSET['kickstart']['rhel9_aps'],
'product': PRDS['rhel9'],
'distro': 'rhel9',
Expand Down
4 changes: 3 additions & 1 deletion robottelo/host_helpers/cli_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,10 @@ def setup_org_for_a_custom_repo(self, options=None):
raise CLIFactoryError(f'Failed to publish new version of content view\n{err.msg}')
# Get the version id
cv_info = self._satellite.cli.ContentView.info({'id': cv_id})
lce_promoted = cv_info['lifecycle-environments']
assert len(cv_info['versions']) > 0
cv_info['versions'].sort(key=lambda version: version['id'])
cvv = cv_info['versions'][-1]
lce_promoted = cv_info['lifecycle-environments']
# Promote version to next env
try:
if env_id not in [int(lce['id']) for lce in lce_promoted]:
Expand Down
34 changes: 34 additions & 0 deletions robottelo/host_helpers/repository_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ class YumRepository(BaseRepository):
_type = constants.REPO_TYPE['yum']


class FileRepository(BaseRepository):
"""Custom File repository"""

_type = constants.REPO_TYPE['file']


class DockerRepository(BaseRepository):
"""Custom Docker repository"""

Expand Down Expand Up @@ -151,6 +157,34 @@ def create(self, organization_id, product_id, download_policy=None, synchronize=
return repo_info


class AnsibleRepository(BaseRepository):
"""Custom Ansible Collection repository"""

_type = constants.REPO_TYPE['ansible_collection']

def __init__(self, url=None, distro=None, requirements=None):
self._requirements = requirements
super().__init__(url=url, distro=distro)

@property
def requirements(self):
return self._requirements

def create(self, organization_id, product_id, download_policy=None, synchronize=True):
repo_info = self.satellite.cli_factory.make_repository(
{
'product-id': product_id,
'content-type': self.content_type,
'url': self.url,
'ansible-collection-requirements': f'{{collections: {self.requirements}}}',
}
)
self._repo_info = repo_info
if synchronize:
self.synchronize()
return repo_info


class OSTreeRepository(BaseRepository):
"""Custom OSTree repository"""

Expand Down
16 changes: 14 additions & 2 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,14 +1727,26 @@ def __init__(self, hostname=None, **kwargs):
self._api = type('api', (), {'_configured': False})
self._cli = type('cli', (), {'_configured': False})

def _swap_nailgun(self, new_version):
"""Install a different version of nailgun from GitHub and invalidate the module cache."""
import sys

from pip._internal import main as pip_main

pip_main(['uninstall', '-y', 'nailgun'])
pip_main(['install', f'https://github.com/SatelliteQE/nailgun/archive/{new_version}.zip'])
self._api = type('api', (), {'_configured': False})
to_clear = [k for k in sys.modules.keys() if 'nailgun' in k]
[sys.modules.pop(k) for k in to_clear]

@property
def api(self):
"""Import all nailgun entities and wrap them under self.api"""
if not self._api:
self._api = type('api', (), {'_configured': False})
if self._api._configured:
return self._api

from nailgun import entities as _entities # use a private import
from nailgun.config import ServerConfig
from nailgun.entity_mixins import Entity

Expand All @@ -1754,7 +1766,7 @@ class DecClass(cls):
verify=settings.server.verify_ca,
)
# add each nailgun entity to self.api, injecting our server config
for name, obj in entities.__dict__.items():
for name, obj in _entities.__dict__.items():
try:
if Entity in obj.mro():
# create a copy of the class and inject our server config into the __init__
Expand Down
Loading

0 comments on commit d89d714

Please sign in to comment.