Skip to content

Commit

Permalink
cu-case-verify-worker-hosts-queue-1-service-has-proceed (#14621)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1bf74b5)
  • Loading branch information
vijaysawant authored and web-flow committed Apr 4, 2024
1 parent cd020bd commit 2fa1241
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/foreman/cli/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""
from datetime import date, datetime, timedelta
from operator import itemgetter
import re

from broker import Broker
import pytest
Expand Down Expand Up @@ -1534,3 +1535,44 @@ def test_errata_list_by_contentview_filter(module_sca_manifest_org, module_targe
)
)
assert errata_count != errata_count_cvf


@pytest.mark.rhel_ver_match('8')
def test_positive_verify_errata_recalculate_tasks(target_sat, errata_host):
"""Verify 'Actions::Katello::Applicability::Hosts::BulkGenerate' tasks proceed on 'worker-hosts-queue-1.service'
:id: d5f89df2-b8fb-4aec-839d-b548b0aadc0c
:setup: Register host which has applicable errata with satellite
:steps:
1. Run 'hammer host errata recalculate --host-id NUMBER' (will trigger inside errata_host fixture)
2. Check systemctl or journalctl or /var/log/messages for '[email protected]'
:expectedresults: worker-hosts-queue-1 should proceed with task and this can be cross verify using unique PID
:customerscenario: true
:BZ: 2249736
"""
# Recalculate errata command has triggered inside errata_host fixture

# get PID of 'worker-hosts-queue-1' from /var/log/messages
message_log = target_sat.execute(
'grep "dynflow-sidekiq@worker-hosts-queue-1" /var/log/messages | tail -1'
)
assert message_log.status == 0
pattern_1 = r'\[(.*?)\]' # pattern to capture PID of 'worker-hosts-queue-1'
match = re.search(pattern_1, message_log.stdout)
pid_log_message = match.group(1)

# get PID of 'worker-hosts-queue-1' from systemctl command output
systemctl_log = target_sat.execute(
'systemctl status [email protected] | grep -i "Main PID:"'
)
assert systemctl_log.status == 0
pattern_2 = r'\: (.*?) \(' # pattern to capture PID of 'worker-hosts-queue-1'
match = re.search(pattern_2, systemctl_log.stdout)
pid_systemctl_cmd = match.group(1)

assert pid_log_message == pid_systemctl_cmd

0 comments on commit 2fa1241

Please sign in to comment.