Skip to content

Commit

Permalink
Merge branch 'master' into virtwho_cli_deploy_type_formdata_virtwhoco…
Browse files Browse the repository at this point in the history
…nfig_support
  • Loading branch information
yanpliu authored Nov 17, 2023
2 parents 66f8a6a + 6e804fa commit 387e694
Show file tree
Hide file tree
Showing 206 changed files with 6,117 additions and 4,364 deletions.
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### Problem Statement


### Solution


### Related Issues


<!-- ### PRT test Cases example
trigger: test-robottelo
pytest: tests/foreman/ui/test_contenthost.py -k 'test_syspurpose_mismatched'
-->
<!--
PRT usage reference link: https://github.com/SatelliteQE/robottelo/wiki/Robottelo-Pull-Request-Testing-(PRT)-Process#usage-examples
-->
15 changes: 9 additions & 6 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,18 @@ jobs:
- name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's
id: add-parent-prt-comment
if: ${{ always() && steps.cherrypick.outcome == 'success' }}
uses: mshick/add-pr-comment@v2
with:
issue: ${{ steps.cherrypick.outputs.number }}
message: ${{ needs.find-the-parent-prt-comment.outputs.prt_comment }}
repo-token: ${{ secrets.CHERRYPICK_PAT }}
run: |
ISSUE_NUMBER=${{ steps.cherrypick.outputs.number }}
COMMENT_BODY=${{ needs.find-the-parent-prt-comment.outputs.prt_comment }}
curl -X POST -H "Authorization: token ${{ secrets.CHERRYPICK_PAT }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/comments" \
-d "{\"body\":\"$COMMENT_BODY\"}"
- 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
56 changes: 30 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# configuration for pre-commit git hooks

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: tests/foreman/data/
- id: check-yaml
- id: debug-statements
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.277
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: local
hooks:
- id: fix-uuids
name: Robottelo Custom Fix UUIDs script
description: This hook runs the scripts/fix_uuids.sh script
language: script
entry: scripts/fix_uuids.sh
verbose: true
types: [text]
require_serial: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: tests/foreman/data/
- id: check-yaml
- id: debug-statements
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.277
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: local
hooks:
- id: fix-uuids
name: Robottelo Custom Fix UUIDs script
description: This hook runs the scripts/fix_uuids.sh script
language: script
entry: scripts/fix_uuids.sh
verbose: true
types: [text]
require_serial: true
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ test-docstrings: uuid-check
testimony $(TESTIMONY_OPTIONS) validate tests/foreman/ui
testimony $(TESTIMONY_OPTIONS) validate tests/foreman/virtwho
testimony $(TESTIMONY_OPTIONS) validate tests/foreman/maintain
testimony $(TESTIMONY_OPTIONS) validate tests/upgrades

test-robottelo:
$(info "Running robottelo framework unit tests...")
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
20 changes: 20 additions & 0 deletions conf/docker.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,23 @@ DOCKER:
PRIVATE_REGISTRY_USERNAME:
# Private docker registry password
PRIVATE_REGISTRY_PASSWORD:
# Image Pass Registry
IMAGE_REGISTRY:
# image repository URL
URL:
# Pull a non-namespace image using the image pass registry proxy
NON_NAMESPACE:
# Proxy for the non-namespace image
PROXY:
# Username for the non-namespace image pass registry proxy
USERNAME:
# Password for the non-namespace image pass registry proxy
PASSWORD:
# Pull a namespace image using the image pass registry proxy
NAMESPACE:
# proxy for the namespace image
PROXY:
# Username for the namespace image pass registry proxy
USERNAME:
# Password for the namespace image pass registry proxy
PASSWORD:
4 changes: 4 additions & 0 deletions conf/server.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ SERVER:
ADMIN_USERNAME: admin
# Admin password when accessing API and UI
ADMIN_PASSWORD: changeme
# Set to true to verify against the certificate given in REQUESTS_CA_BUNDLE
# Or specify path to certificate path or directory
# see: https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification
VERIFY_CA: false

SSH_CLIENT:
# Specify port number for ssh client, Default: 22
Expand Down
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'pytest_fixtures.component.computeprofile',
'pytest_fixtures.component.contentview',
'pytest_fixtures.component.domain',
'pytest_fixtures.component.discovery',
'pytest_fixtures.component.host',
'pytest_fixtures.component.hostgroup',
'pytest_fixtures.component.http_proxy',
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ select = [
"F", # flake8
"I", # isort
# "Q", # flake8-quotes
"PT", # flake8-pytest
"UP", # pyupgrade
"W", # pycodestyle
]

ignore = [
"E501", # line too long - handled by black
"PT004", # pytest underscrore prefix for non-return fixtures
"PT005", # pytest no underscrore prefix for return fixtures
]

[tool.ruff.isort]
Expand All @@ -40,6 +43,9 @@ known-first-party = [
]
combine-as-imports = true

[tool.ruff.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false

[tool.ruff.flake8-quotes]
inline-quotes = "single"
Expand Down
31 changes: 31 additions & 0 deletions pytest_fixtures/component/discovery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from fauxfactory import gen_string
import pytest


@pytest.fixture(scope='module')
def module_discovery_hostgroup(module_org, module_location, module_target_sat):
host = module_target_sat.api.Host(organization=module_org, location=module_location).create()
return module_target_sat.api.HostGroup(
organization=[module_org],
location=[module_location],
medium=host.medium,
root_pass=gen_string('alpha'),
operatingsystem=host.operatingsystem,
ptable=host.ptable,
domain=host.domain,
architecture=host.architecture,
).create()


@pytest.fixture(scope='module')
def discovery_org(module_org, module_target_sat):
discovery_org = module_target_sat.update_setting('discovery_organization', module_org.name)
yield module_org
module_target_sat.update_setting('discovery_organization', discovery_org)


@pytest.fixture(scope='module')
def discovery_location(module_location, module_target_sat):
discovery_loc = module_target_sat.update_setting('discovery_location', module_location.name)
yield module_location
module_target_sat.update_setting('discovery_location', discovery_loc)
10 changes: 5 additions & 5 deletions pytest_fixtures/component/domain.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Domain Fixtures
from nailgun import entities
import pytest


@pytest.fixture(scope='session')
def default_domain(session_target_sat, default_smart_proxy):
domain_name = session_target_sat.hostname.partition('.')[-1]
dom = entities.Domain().search(query={'search': f'name={domain_name}'})[0]
dom.dns = default_smart_proxy
dom.update(['dns'])
return entities.Domain(id=dom.id).read()
dom = session_target_sat.api.Domain().search(query={'search': f'name={domain_name}'})[0]
if 'dns' in session_target_sat.get_features():
dom.dns = default_smart_proxy
dom.update(['dns'])
return session_target_sat.api.Domain(id=dom.id).read()


@pytest.fixture(scope='module')
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from robottelo.config import settings


@pytest.fixture(scope='function')
@pytest.fixture
def setup_http_proxy(request, module_manifest_org, target_sat):
"""Create a new HTTP proxy and set related settings based on proxy"""
http_proxy = target_sat.api_factory.make_http_proxy(module_manifest_org, request.param)
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/katello_certs_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def certs_data(sat_ready_rhel):
cert_data['key_file_name'] = f'{sat_ready_rhel.hostname}/{sat_ready_rhel.hostname}.key'
cert_data['cert_file_name'] = f'{sat_ready_rhel.hostname}/{sat_ready_rhel.hostname}.crt'
sat_ready_rhel.custom_cert_generate(cert_data['capsule_hostname'])
yield cert_data
return cert_data


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions pytest_fixtures/component/lce.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def module_lce(module_org, module_target_sat):
return module_target_sat.api.LifecycleEnvironment(organization=module_org).create()


@pytest.fixture(scope='function')
@pytest.fixture
def function_lce(function_org, target_sat):
return target_sat.api.LifecycleEnvironment(organization=function_org).create()

Expand All @@ -31,7 +31,7 @@ def module_lce_library(module_org, module_target_sat):
)


@pytest.fixture(scope='function')
@pytest.fixture
def function_lce_library(function_org, target_sat):
"""Returns the Library lifecycle environment from chosen organization"""
return (
Expand Down
4 changes: 2 additions & 2 deletions pytest_fixtures/component/maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def module_stash(request):
# Please refer the documentation for more details on stash
# https://docs.pytest.org/en/latest/reference/reference.html#stash
request.node.stash[synced_repos] = {}
yield request.node.stash
return request.node.stash


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -98,7 +98,7 @@ def module_synced_repos(sat_maintain, module_capsule_configured, module_sca_mani
sync_status = module_capsule_configured.nailgun_capsule.content_sync()
assert sync_status['result'] == 'success'

yield {
return {
'custom': module_stash[synced_repos]['cust_repo'],
'rh': module_stash[synced_repos]['rh_repo'],
}
Expand Down
8 changes: 4 additions & 4 deletions pytest_fixtures/component/provision_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
@pytest.fixture(scope='session')
def sat_azure(request, session_puppet_enabled_sat, session_target_sat):
hosts = {'sat': session_target_sat, 'puppet_sat': session_puppet_enabled_sat}
yield hosts[request.param]
return hosts[request.param]


@pytest.fixture(scope='module')
def sat_azure_org(sat_azure):
yield sat_azure.api.Organization().create()
return sat_azure.api.Organization().create()


@pytest.fixture(scope='module')
def sat_azure_loc(sat_azure):
yield sat_azure.api.Location().create()
return sat_azure.api.Location().create()


@pytest.fixture(scope='module')
def sat_azure_domain(sat_azure, sat_azure_loc, sat_azure_org):
yield sat_azure.api.Domain(location=[sat_azure_loc], organization=[sat_azure_org]).create()
return sat_azure.api.Domain(location=[sat_azure_loc], organization=[sat_azure_org]).create()


@pytest.fixture(scope='module')
Expand Down
10 changes: 5 additions & 5 deletions pytest_fixtures/component/provision_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
@pytest.fixture(scope='session')
def sat_gce(request, session_puppet_enabled_sat, session_target_sat):
hosts = {'sat': session_target_sat, 'puppet_sat': session_puppet_enabled_sat}
yield hosts[getattr(request, 'param', 'sat')]
return hosts[getattr(request, 'param', 'sat')]


@pytest.fixture(scope='module')
def sat_gce_org(sat_gce):
yield sat_gce.api.Organization().create()
return sat_gce.api.Organization().create()


@pytest.fixture(scope='module')
def sat_gce_loc(sat_gce):
yield sat_gce.api.Location().create()
return sat_gce.api.Location().create()


@pytest.fixture(scope='module')
def sat_gce_domain(sat_gce, sat_gce_loc, sat_gce_org):
yield sat_gce.api.Domain(location=[sat_gce_loc], organization=[sat_gce_org]).create()
return sat_gce.api.Domain(location=[sat_gce_loc], organization=[sat_gce_org]).create()


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -282,7 +282,7 @@ def module_gce_finishimg(
return finish_image


@pytest.fixture()
@pytest.fixture
def gce_setting_update(sat_gce):
sat_gce.update_setting('destroy_vm_on_host_delete', True)
yield
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/provision_libvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def module_libvirt_image(module_target_sat, module_cr_libvirt):
def module_libvirt_provisioning_sat(module_provisioning_sat):
# Configure Libvirt CR for provisioning
module_provisioning_sat.sat.configure_libvirt_cr()
yield module_provisioning_sat
return module_provisioning_sat
Loading

0 comments on commit 387e694

Please sign in to comment.