Skip to content

Conversation

@phillxnet
Copy link
Member

@phillxnet phillxnet commented Oct 9, 2023

Update our Django dependency. It is generally recommended to only update Django from one LTS to the next: 2.2 LTS is our next-in-line.

Includes a prior overlooked migration intended for this Django update. See:GitHub #2666 #2667

Work in progress re issu #2625

Update our Django dependency. It is generally recommended
to only update Django from one LTS to the next: 2.2 LTS
is our next-in-line.

Includes a prior overlooked migration intended for this
Django update. See:GitHub rockstor#2666 rockstor#2667
@phillxnet
Copy link
Member Author

Using this Draft PR to assist with collaboration on this significant change-set:

To date, with the changes detailed thus far, we have a single test failure:

======================================================================
FAIL: test_get (rockstor.storageadmin.tests.test_appliances.AppliancesTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/rockstor/src/rockstor/storageadmin/tests/test_appliances.py", line 68, in test_get
    self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.data)
AssertionError: 500 != 200 : ["Database queries to 'smart_manager' are not allowed in this test. Add 'smart_manager' to rockstor.storageadmin.tests.test_appliances.AppliancesTests.databases to ensure proper test isolation and silence this failure.", 'Traceback (most recent call last):\n  File "/opt/rockstor/src/rockstor/storageadmin/models/appliance.py", line 45, in ipaddr\n    so = Service.objects.get(name="rockstor")\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 402, in get\n    num = len(clone)\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 256, in __len__\n    self._fetch_all()\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all\n    self._result_cache = list(self._iterable_class(self))\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__\n    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql\n    cursor = self.connection.cursor()\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/test/testcases.py", line 144, in __call__\n    raise AssertionError(self.message)\nAssertionError: Database queries to \'smart_manager\' are not allowed in this test. Add \'smart_manager\' to rockstor.storageadmin.tests.test_appliances.AppliancesTests.databases to ensure proper test isolation and silence this failure.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py", line 41, in _handle_exception\n    yield\n  File "/opt/rockstor/src/rockstor/storageadmin/views/appliances.py", line 42, in get_queryset\n    self._update_hostname()\n  File "/usr/lib64/python3.6/contextlib.py", line 52, in inner\n    return func(*args, **kwds)\n  File "/opt/rockstor/src/rockstor/storageadmin/views/appliances.py", line 53, in _update_hostname\n    if a.ipaddr != a.ip:\n  File "/opt/rockstor/src/rockstor/storageadmin/models/appliance.py", line 60, in ipaddr\n    raise Exception(e)\nException: Database queries to \'smart_manager\' are not allowed in this test. Add \'smart_manager\' to rockstor.storageadmin.tests.test_appliances.AppliancesTests.databases to ensure proper test isolation and silence this failure.\n']

----------------------------------------------------------------------
Ran 262 tests in 28.596s

FAILED (failures=1)

Which on first glance looks to be a tightening of cross db query within tests.

@phillxnet
Copy link
Member Author


/opt/rockstor/.venv/lib/python3.6/site-packages/django/test/testcases.py:887: RemovedInDjango31Warning: `TestCase.multi_db` is deprecated. Databases available during this test can be defined using rockstor.smart_manager.tests.test_snmp.SNMPTests.databases.
  warnings.warn(msg, RemovedInDjango31Warning)
/opt/rockstor/.venv/lib/python3.6/site-packages/django/test/testcases.py:887: RemovedInDjango31Warning: `TestCase.multi_db` is deprecated. Databases available during this test can be defined using rockstor.smart_manager.tests.test_task_scheduler.TaskSchedulerTests.databases.
  warnings.warn(msg, RemovedInDjango31Warning)
/opt/rockstor/.venv/lib/python3.6/site-packages/django/test/testcases.py:887: RemovedInDjango31Warning: `TestCase.multi_db` is deprecated. Databases available during this test can be defined using rockstor.storageadmin.tests.test_shares.ShareTests.databases.
  warnings.warn(msg, RemovedInDjango31Warning)
Creating test database for alias 'default'...
Creating test database for alias 'smart_manager'...
/opt/rockstor/.venv/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py:498: RemovedInDjango31Warning: CachedStaticFilesStorage is deprecated in favor of ManifestStaticFilesStorage.
  self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
...
Failure
Traceback (most recent call last):
  File "/opt/rockstor/src/rockstor/storageadmin/tests/test_appliances.py", line 68, in test_get
    self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.data)
AssertionError: 500 != 200 : ["Database queries to 'smart_manager' are not allowed in this test. Add 'smart_manager' to rockstor.storageadmin.tests.test_appliances.AppliancesTests.databases to ensure proper test isolation and silence this failure.", 'Traceback (most recent call last):\n  File "/opt/rockstor/src/rockstor/storageadmin/models/appliance.py", line 45, in ipaddr\n    so = Service.objects.get(name="rockstor")\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 402, in get\n    num = len(clone)\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 256, in __len__\n    self._fetch_all()\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all\n    self._result_cache = list(self._iterable_class(self))\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/query.py", line 55, in __iter__\n    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql\n    cursor = self.connection.cursor()\n  File "/opt/rockstor/.venv/lib/python3.6/site-packages/django/test/testcases.py", line 144, in __call__\n    raise AssertionError(self.message)\nAssertionError: Database queries to \'smart_manager\' are not allowed in this test. Add \'smart_manager\' to rockstor.storageadmin.tests.test_appliances.AppliancesTests.databases to ensure proper test isolation and silence this failure.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py", line 41, in _handle_exception\n    yield\n  File "/opt/rockstor/src/rockstor/storageadmin/views/appliances.py", line 42, in get_queryset\n    self._update_hostname()\n  File "/usr/lib64/python3.6/contextlib.py", line 52, in inner\n    return func(*args, **kwds)\n  File "/opt/rockstor/src/rockstor/storageadmin/views/appliances.py", line 53, in _update_hostname\n    if a.ipaddr != a.ip:\n  File "/opt/rockstor/src/rockstor/storageadmin/models/appliance.py", line 60, in ipaddr\n    raise Exception(e)\nException: Database queries to \'smart_manager\' are not allowed in this test. Add \'smart_manager\' to rockstor.storageadmin.tests.test_appliances.AppliancesTests.databases to ensure proper test isolation and silence this failure.\n']
...
/opt/rockstor/.venv/lib/python3.6/site-packages/django/test/testcases.py:887: RemovedInDjango31Warning: `TestCase.multi_db` is deprecated. Databases available during this test can be defined using rockstor.storageadmin.tests.test_shares.ShareTests.databases.
  warnings.warn(msg, RemovedInDjango31Warning)

@phillxnet
Copy link
Member Author

phillxnet commented Oct 10, 2023

- RemovedInDjango31Warning: TestCase.multi_db is deprecated.
@phillxnet
Copy link
Member Author

phillxnet commented Oct 10, 2023

CachedStaticFilesStorage is deprecated in favor of ManifestStaticFilesStorage.

https://docs.djangoproject.com/en/4.2/releases/2.2/#id2

django.contrib.staticfiles.storage.CachedStaticFilesStorage is deprecated due to the intractable problems that it has. Use ManifestStaticFilesStorage or a third-party cloud storage instead.

This remaining deprecation warning is to be addressed as part of the spin-off issue: Update django-pipeline within Django constrains #2689

@phillxnet
Copy link
Member Author

The current development branch for this draft PR now passes all tests:

----------------------------------------------------------------------
Ran 262 tests in 29.163s

OK

Moving to squash and re-submit.

@phillxnet phillxnet closed this Oct 10, 2023
@phillxnet phillxnet deleted the 2625-Provisional-Django-2.2-LTS-update branch October 10, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant