Skip to content

Commit

Permalink
Merge branch 'master' into reporting_test_fixes_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse authored Dec 10, 2024
2 parents 6c1e5af + c170b84 commit 35b06c4
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.8.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 2 additions & 0 deletions conf/robottelo.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ ROBOTTELO:
SETTINGS:
GET_FRESH: true
IGNORE_VALIDATION_ERRORS: false
# Stage docs url
STAGE_DOCS_URL: https://docs.redhat.com
28 changes: 15 additions & 13 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,19 +364,18 @@ def installer_satellite(request):
# enable satellite repos
for repo in sat.SATELLITE_CDN_REPOS.values():
sat.enable_repo(repo, force=True)
elif settings.server.version.source == 'nightly':
sat.create_custom_repos(
satellite_repo=settings.repos.satellite_repo,
satmaintenance_repo=settings.repos.satmaintenance_repo,
)
else:
if settings.server.version.source == 'nightly':
sat.create_custom_repos(
satellite_repo=settings.repos.satellite_repo,
satmaintenance_repo=settings.repos.satmaintenance_repo,
)
else:
# get ohsnap repofile
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
snap=settings.server.version.snap,
)
# get ohsnap repofile
sat.download_repofile(
product='satellite',
release=settings.server.version.release,
snap=settings.server.version.snap,
)

if settings.robottelo.rhel_source == "internal":
# disable rhel repos from cdn
Expand All @@ -386,7 +385,7 @@ def installer_satellite(request):

sat.install_satellite_or_capsule_package()
# Install Satellite
sat.execute(
installer_result = sat.execute(
InstallerCommand(
installer_args=[
'scenario satellite',
Expand All @@ -395,6 +394,9 @@ def installer_satellite(request):
).get_command(),
timeout='30m',
)
# exit code 0 means no changes, 2 means changes were applied succesfully
assert installer_result.status in (0, 2), installer_result.stdout

sat.enable_satellite_ipv6_http_proxy()
if 'sanity' in request.config.option.markexpr:
configure_nailgun()
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ fauxfactory==3.1.1
jinja2==3.1.4
manifester==0.2.8
navmazing==1.2.2
productmd==1.42
productmd==1.43
pyotp==2.9.0
python-box==7.2.0
python-box==7.3.0
pytest==8.3.4
pytest-order==1.3.0
pytest-services==2.2.1
Expand Down
1 change: 1 addition & 0 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
Validator('remotedb.port', default=5432),
],
robottelo=[
Validator('robottelo.stage_docs_url', default='https://docs.redhat.com'),
Validator('robottelo.settings.ignore_validation_errors', is_type_of=bool, default=False),
Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']),
Validator(
Expand Down
6 changes: 3 additions & 3 deletions tests/foreman/api/test_provisioningtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def test_positive_template_check_rex_snippet(
assert f'chown -R {rex_user}: ~{rex_user}' in rex_snippet
assert f'chown -R {rex_user}: ~{rex_user}/.ssh' in rex_snippet
assert (
f'echo "{rex_user} ALL = (root) NOPASSWD : ALL" > /etc/sudoers.d/{rex_user}\necho "Defaults:{rex_user} !requiretty" >> /etc/sudoers.d/{rex_user}'
f'echo "{rex_user} ALL = (ALL) NOPASSWD : ALL" > /etc/sudoers.d/{rex_user}\necho "Defaults:{rex_user} !requiretty" >> /etc/sudoers.d/{rex_user}'
in rex_snippet
)
assert ssh_key in rex_snippet
Expand Down Expand Up @@ -646,8 +646,8 @@ def test_positive_template_check_rex_pull_mode_snippet(
pkg_manager = 'yum' if module_sync_kickstart_content.rhel_ver < 8 else 'dnf'
assert f'{pkg_manager} -y install foreman_ygg_worker' in rex_snippet
assert 'broker = ["mqtts://$SERVER_NAME:1883"]' in rex_snippet
assert 'systemctl try-restart yggdrasild' in rex_snippet
assert 'systemctl enable --now yggdrasild' in rex_snippet
assert 'systemctl try-restart $YGGDRASIL_SERVICE' in rex_snippet
assert 'systemctl enable --now $YGGDRASIL_SERVICE' in rex_snippet
assert 'yggdrasil status' in rex_snippet
assert 'Remote execution pull provider successfully configured!' in rex_snippet

Expand Down
10 changes: 5 additions & 5 deletions tests/foreman/installer/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ def common_sat_install_assertions(satellite):
result = satellite.execute(
r'journalctl --quiet --no-pager --boot --priority err -u "dynflow-sidekiq*" -u "foreman-proxy" -u "foreman" -u "httpd" -u "postgresql" -u "pulpcore-api" -u "pulpcore-content" -u "pulpcore-worker*" -u "redis" -u "tomcat"'
)
assert len(result.stdout) == 0
assert not result.stdout
# no errors in /var/log/foreman/production.log
result = satellite.execute(r'grep --context=100 -E "\[E\|" /var/log/foreman/production.log')
if not is_open('SAT-21086'):
assert len(result.stdout) == 0
assert not result.stdout
# no errors/failures in /var/log/foreman-installer/satellite.log
result = satellite.execute(
r'grep "\[ERROR" --context=100 /var/log/foreman-installer/satellite.log'
)
assert len(result.stdout) == 0
assert not result.stdout
# no errors/failures in /var/log/httpd/*
result = satellite.execute(r'grep -iR "error" /var/log/httpd/*')
assert len(result.stdout) == 0
assert not result.stdout
# no errors/failures in /var/log/candlepin/*
result = satellite.execute(r'grep -iR "error" /var/log/candlepin/*')
assert len(result.stdout) == 0
assert not result.stdout

httpd_log = satellite.execute('journalctl --unit=httpd')
assert "WARNING" not in httpd_log.stdout
Expand Down
35 changes: 33 additions & 2 deletions tests/foreman/ui/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,28 @@ def test_positive_assign_ansible_role_variable_on_host(
module_org,
module_location,
):
"""Verify ansible variable is added to the role and attached to the host.
"""Verify ansible variable is added to the role and attached to the host and delete updated value in variable
:id: 7ec4fe19-5a08-4b10-bb4e-7327dd68699a
:BZ: 2170727
:Verifies: SAT-23109
:customerscenario: true
:steps:
1. Create an Ansible variable with array type and set the default value.
2. Enable both 'Merge Overrides' and 'Merge Default'.
3. Add the variable to a role and attach the role to the host.
4. Verify that ansible role and variable is added to the host.
5. Override the variable value.
6. Reset the overridden value to the original value.
:expectedresults: The role and variable is successfully added to the host.
:expectedresults:
1. The role and variable is successfully added to the host.
2. The overridden value in the variable was successfully deleted, and the default value remains unchanged.
"""

@request.addfinalizer
Expand Down Expand Up @@ -229,6 +236,30 @@ def _finalize():
(v['Name'], v['Ansible role'], v['Type'], v['Value']) for v in variable_table
]

new_key = gen_string('alpha')
session.ansiblevariables.create_with_overrides(
{
'key': new_key,
'ansible_role': SELECTED_ROLE[0],
'override': 'true',
'parameter_type': parameter_type,
'default_value': default_value,
}
)
new_value = '["test update"]'
# Update the value in a variable.
session.host_new.update_variable_value(rhel_contenthost.hostname, new_key, new_value)
update_value = session.host_new.read_variable_value(rhel_contenthost.hostname, new_key)
assert new_value in update_value

# Revert the updated value to its default state.
session.host_new.del_variable_value(rhel_contenthost.hostname)
reset_variable_value = session.host_new.read_variable_value(
rhel_contenthost.hostname, new_key
)
assert new_value not in reset_variable_value
assert default_value in reset_variable_value

@pytest.mark.tier3
@pytest.mark.parametrize('setting_update', ['ansible_roles_to_ignore'], indirect=True)
def test_positive_ansible_roles_ignore_list(self, target_sat, setting_update):
Expand Down
11 changes: 7 additions & 4 deletions tests/foreman/ui/test_documentation_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@


@pytest.mark.e2e
@pytest.mark.skipif(
(settings.server.version.release.split('.')[0:2] in settings.robottelo.sat_non_ga_versions),
reason="The test don't yet support verifying documentation links for non GA'ed Satellite release.",
)
def test_positive_documentation_links(target_sat):
"""Verify that Satellite documentation links are working.
Note: At the moment, the test doesn't support verifying links hidden behind a button.
Expand Down Expand Up @@ -67,6 +63,7 @@ def test_positive_documentation_links(target_sat):
'factvalue',
'dashboard',
]
sat_version = ".".join(target_sat.version.split('.')[0:2])
all_links = defaultdict(list)
pages_with_broken_links = defaultdict(list)
with target_sat.ui_session() as session:
Expand All @@ -86,6 +83,12 @@ def test_positive_documentation_links(target_sat):
)
for page in pages:
for link in all_links[page]:
# Test stage docs url for Non-GA'ed Satellite
if sat_version in settings.robottelo.sat_non_ga_versions:
link = link.replace(
'https://docs.redhat.com', settings.robottelo.stage_docs_url
)
link = link.replace('html', 'html-single')
if requests.get(link, verify=False).status_code != 200:
pages_with_broken_links[page].append(link)
logger.info(f"Following link on {page} page seems broken: \n {link}")
Expand Down

0 comments on commit 35b06c4

Please sign in to comment.