Project

Profile

Help

Issue #3955

closed

Pulp unit tests breaking on F27

Added by daviddavis over 5 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
2.17.1
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Sprint 42
Quarter:

Description

See this PR as an example:

https://github.com/pulp/pulp/pull/3591

Here's the failing test:

======================================================================
ERROR: test_state_validation (unit.server.db.model.test_dispatch.TestTaskStatus)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/workspace/unittest-pulp-pr/node-type/f27-os/pulp/server/test/unit/server/db/model/test_dispatch.py", line 169, in test_state_validation
    state=invalid_state).save)
  File "/usr/lib64/python2.7/unittest/case.py", line 511, in assertRaises
    callableObj(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/mongoengine/document.py", line 362, in save
    self.validate(clean=clean)
  File "/usr/lib/python2.7/site-packages/mongoengine/base/document.py", line 379, in validate
    field._validate(value)
  File "/usr/lib/python2.7/site-packages/mongoengine/base/fields.py", line 224, in _validate
    self._validate_choices(value)
  File "/usr/lib/python2.7/site-packages/mongoengine/base/fields.py", line 218, in _validate_choices
    if len(set(values) - set(choice_list)):
TypeError: unhashable type: 'dict'

It looks like the tests started failing sometime between August 14-17. I think there was an upgrade from mongoengine 0.15.1 to 0.15.3.

Actions #1

Updated by daviddavis over 5 years ago

  • Subject changed from Pulp tests breaking on F27 to Pulp unit tests breaking on F27
Actions #2

Updated by daviddavis over 5 years ago

  • Sprint set to Sprint 42
Actions #3

Updated by ipanova@redhat.com over 5 years ago

https://github.com/pulp/pulp/pull/3610 please unskip this test when working on the issue.

Actions #4

Updated by daviddavis over 5 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis
Actions #5

Updated by daviddavis over 5 years ago

Here's the problem. In mongoengine 0.15.2, a change was made to validate fields that contain lists[0]. The problem is that we're passing in an empty dict[1]. So the code calls set([{}]). This raises the error we're seeing. I can open an issue against mongoengine but I think they're going to tell us to not use bogus data like empty dicts (if they respond at all—they have 300+ open issues). I'm wondering if we shouldn't just remove the empty dict from our list of invalid values in this test.

[0] https://github.com/MongoEngine/mongoengine/commit/e6a30f899c9bb6cdb28e2302967e6dc96ceac055#diff-bf75ac33c85aac443260852e16396a3bR218
[1] https://github.com/pulp/pulp/blob/2-master/server/test/unit/server/db/model/test_dispatch.py#L168

Actions #6

Updated by daviddavis over 5 years ago

  • Status changed from ASSIGNED to POST
  • Assignee changed from daviddavis to dkliban@redhat.com

Added by dkliban@redhat.com over 5 years ago

Revision fe93f013 | View on GitHub

Fixes broken unit test around TaskStatus model

The test uses a list of various objects as invalid inputs for a Task status. One of the objects is a dict which mongoengine does not support as a value because it's not hashable. This patch removes the dict from the list of possible bad inputs.

closes: #3955 https://pulp.plan.io/issues/3955

Actions #7

Updated by dkliban@redhat.com over 5 years ago

  • Status changed from POST to MODIFIED
Actions #8

Updated by dkliban@redhat.com over 5 years ago

  • Platform Release set to 2.17.1

Added by dkliban@redhat.com over 5 years ago

Revision df1c3e5b | View on GitHub

Fixes broken unit test around TaskStatus model

The test uses a list of various objects as invalid inputs for a Task status. One of the objects is a dict which mongoengine does not support as a value because it's not hashable. This patch removes the dict from the list of possible bad inputs.

closes: #3955 https://pulp.plan.io/issues/3955 (cherry picked from commit fe93f013deba078c7d8e927dfef0476f1216c33f)

Actions #10

Updated by ttereshc over 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions #11

Updated by bmbouter almost 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF