Issue #3955
closedPulp unit tests breaking on F27
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.
Updated by daviddavis about 6 years ago
- Subject changed from Pulp tests breaking on F27 to Pulp unit tests breaking on F27
Updated by ipanova@redhat.com about 6 years ago
https://github.com/pulp/pulp/pull/3610 please unskip this test when working on the issue.
Updated by daviddavis about 6 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to daviddavis
Updated by daviddavis about 6 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
Updated by daviddavis about 6 years ago
- Status changed from ASSIGNED to POST
- Assignee changed from daviddavis to dkliban@redhat.com
Added by dkliban@redhat.com about 6 years ago
Updated by dkliban@redhat.com about 6 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulp|fe93f013deba078c7d8e927dfef0476f1216c33f.
Added by dkliban@redhat.com about 6 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)
Updated by dkliban@redhat.com about 6 years ago
Applied in changeset pulp|df1c3e5b3ab3c3e7d7ae81f73c114c4aa150b303.
Updated by ttereshc about 6 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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