Uploaded image for project: 'Red Hat OpenStack Services on OpenShift'
  1. Red Hat OpenStack Services on OpenShift
  2. OSPRH-2920

BZ#2239834 TypeError: write() argument must be str, not MagicMock in osp-rpm-py39 / OSP 18

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • openstack-ironic
    • False
    • Hide

      None

      Show
      None
    • False
    • Committed
    • Committed
    • Committed
    • No
    • Moderate

      Hello,

      we observe a failure in RPM job executed as part of Component CI for OSP 18

      ```
      ironic.tests.unit.drivers.modules.test_pxe.PXEBootTestCase.test_prepare_instance_kickstart_bios
      -----------------------------------------------------------------------------------------------

      Captured traceback:
      ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):

      File "/usr/lib64/python3.9/unittest/mock.py", line 1336, in patched
      return func(*newargs, **newkeywargs)

      File "/home/zuul/src/code.engineering.redhat.com/ironic/ironic/tests/unit/drivers/modules/test_pxe.py", line 653, in test_prepare_instance_kickstart_bios
      task.driver.boot.prepare_instance(task)

      File "/usr/lib/python3.9/site-packages/ironic_lib/metrics.py", line 60, in wrapped
      result = f(*args, **kwargs)

      File "/home/zuul/src/code.engineering.redhat.com/ironic/ironic/drivers/modules/pxe_base.py", line 249, in prepare_instance
      pxe_utils.validate_kickstart_file(ks_cfg)

      File "/home/zuul/src/code.engineering.redhat.com/ironic/ironic/common/pxe_utils.py", line 1164, in validate_kickstart_file
      ks_file.write(ks_cfg)

      File "/usr/lib64/python3.9/tempfile.py", line 478, in func_wrapper
      return func(*args, **kwargs)

      TypeError: write() argument must be str, not MagicMock
      ```

      What we do in the job, is:
      – we fetch the spec file and install the RPM dependencies listed there,
      – we install some missing RPMs identified (that should be in spec file probably, but they are not),
      – we run the tests defined in tox.

      The additional RPMs we install are listed here:
      https://github.com/RedHatCRE/znoyder/blob/6e728306f860ed90054144fefa454d5cd90cc4d0/znoyder/config.d/43-override-OSP-18.yml#L103

      So, in essence, this is a tox job but with truncated requirement.txt and site-packages enabled.

      You can use this change for debugging the issue.
      https://code.engineering.redhat.com/gerrit/c/ironic/+/445376

      Yours,
      Szymon

              jkreger@redhat.com Julia Kreger
              jira-bugzilla-migration RH Bugzilla Integration
              rhos-dfg-hardprov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: