Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-101707

Pagure #9752: ipatests: use "sos report" instead of "sosreport" command

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • ipa-4.12.2-20.el9
    • No
    • Low
    • 2
    • rhel-idm-ipa
    • 25
    • 27
    • 2
    • QE ack, Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • 2025-IDM-IPA-S1, 2025-IDM-IPA-S2
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      Cloned from: https://pagure.io/freeipa/issue/9752
      
      The nightly test `test_ipahealthcheck.py::TestIpaHealthCheck::test_sosreport_includes_healthcheck` is using the `sosreport` command but this command has been deprecated and should be replaced with `sos report`.
      
      The consequence is that the test is failing on rawhide (f43) with sos-4.9.0-2.fc43.noarch. Example of run in https://$ARTIFACTS_SERVER/idm-ci/freeipa_upstream_nightly/Nightly-rawhide/master/2025-02-22_19-30/rawhide/test_ipahealthcheck/4/report.html?sort=result:
      ```
      self = <ipatests.test_integration.test_ipahealthcheck.TestIpaHealthCheck object at 0x7f7156cf3ca0>
      create_logfile = None
      
          def test_sosreport_includes_healthcheck(self, create_logfile):
              """
              This testcase checks that sosreport command
              when run on IPA system with healthcheck installed
              collects healthcheck.log file
              """
              caseid = "123456"
              msg = "[plugin:ipa] collecting path '{}'".format(HEALTHCHECK_LOG)
      >       cmd = self.master.run_command(
                  [
                      "sosreport",
                      "-o",
                      "ipa",
                      "--case-id",
                      caseid,
                      "--batch",
                      "-vv",
                      "--build",
                  ]
              )
      
      caseid     = '123456'
      create_logfile = None
      msg        = "[plugin:ipa] collecting path '/var/log/ipa/healthcheck/healthcheck.log'"
      self       = <ipatests.test_integration.test_ipahealthcheck.TestIpaHealthCheck object at 0x7f7156cf3ca0>
      
      test_integration/test_ipahealthcheck.py:1406: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      self = <ipatests.pytest_ipa.integration.host.Host master.ufreeipa.test (master)>
      argv = ['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', ...]
      set_env = True, stdin_text = None, log_stdout = True, raiseonerr = True
      cwd = None, bg = False, encoding = 'utf-8', ok_returncode = 0
      
          def run_command(self, argv, set_env=True, stdin_text=None,
                          log_stdout=True, raiseonerr=True,
                          cwd=None, bg=False, encoding='utf-8', ok_returncode=0):
              """Wrapper around run_command to log stderr on raiseonerr=True
          
              :param ok_returncode: return code considered to be correct,
                                    you can pass an integer or sequence of integers
              """
              result = super().run_command(
                  argv, set_env=set_env, stdin_text=stdin_text,
                  log_stdout=log_stdout, raiseonerr=False, cwd=cwd, bg=bg,
                  encoding=encoding
              )
              # in FIPS mode SSH may print noise to stderr, remove the string
              # "FIPS mode initialized" + optional newline.
              result.stderr_bytes = FIPS_NOISE_RE.sub(b'', result.stderr_bytes)
              try:
                  result_ok = result.returncode in ok_returncode
              except TypeError:
                  result_ok = result.returncode == ok_returncode
              if not result_ok and raiseonerr:
                  result.log.error('stderr: %s', result.stderr_text)
      >           raise subprocess.CalledProcessError(
                      result.returncode, argv,
                      result.stdout_text, result.stderr_text
                  )
      E           subprocess.CalledProcessError: Command '['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', '-vv', '--build']' returned non-zero exit status 127.
      
      __class__  = <class 'ipatests.pytest_ipa.integration.host.Host'>
      argv       = ['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', ...]
      bg         = False
      cwd        = None
      encoding   = 'utf-8'
      log_stdout = True
      ok_returncode = 0
      raiseonerr = True
      result     = <pytest_multihost.transport.SSHCommand object at 0x7f7156bddc50>
      result_ok  = False
      self       = <ipatests.pytest_ipa.integration.host.Host master.ufreeipa.test (master)>
      set_env    = True
      stdin_text = None
      
      pytest_ipa/integration/host.py:202: CalledProcessError
      
      [...]
      ------------------------------ Captured log call -------------------------------
      INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', '-vv', '--build']
      DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd450:transport.py:513 RUN ['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', '-vv', '--build']
      DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd450:transport.py:557 bash: line 4: sosreport: command not found
      DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd450:transport.py:217 Exit code: 127
      ERROR    ipatests.pytest_ipa.integration.host.Host.master.cmd450:host.py:201 stderr: bash: line 4: sosreport: command not found
      
      ```
      
      On fedora 41 with sos-4.8.2-1.fc41.noarch the same test shows:
      ```
      INFO     ipatests.pytest_ipa.integration.host.Host.master.IPAOpenSSHTransport:transport.py:391 RUN ['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', '-vv', '--build']
      DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd452:transport.py:513 RUN ['sosreport', '-o', 'ipa', '--case-id', '123456', '--batch', '-vv', '--build']
      DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd452:transport.py:557 WARNING: the 'sosreport' command has been deprecated in favor of the new 'sos' command, E.G. 'sos report', and will be removed in the upcoming sos-4.9 release.
      DEBUG    ipatests.pytest_ipa.integration.host.Host.master.cmd452:transport.py:557 Redirecting to 'sos report -o ipa --case-id 123456 --batch -vv --build'
      ```
      
      The [release notes](https://github.com/sosreport/sos/releases/tag/4.9.0) for sos 4.9 mention the removal of the sosreport command redirector:
      ```
      The legacy redirectors for sosreport and sos-collector have been dropped as of this release. The only executable going forward is sos.
      ```
      

              frenaud@redhat.com Florence Renaud
              frenaud@redhat.com Florence Renaud
              Florence Renaud Florence Renaud
              PRANAV THUBE PRANAV THUBE
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: