Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test desktop.auth.view_test.TestRemoteUserLogin fails when hue is built with python3 #2467

Closed
byungnam opened this issue Aug 25, 2021 · 2 comments

Comments

@byungnam
Copy link
Contributor

byungnam commented Aug 25, 2021

Is the issue already present in https://github.com/cloudera/hue/issues or discussed in the forum https://discourse.gethue.com?
No

Describe the bug:
$ hue test specific desktop.auth.views_test.TestRemoteUserLogin fails when hue is built from python3.

Below is one of error logs from the test. Note the test fails on every test in TestRemoteUserLogin.
Error log:

======================================================================
FAIL: desktop.auth.views_test.TestRemoteUserLogin.test_force_lower_case
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/deploy/brandon/khp-package-clean/repositories/hadoopeng/hue/build/env/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/deploy/brandon/khp-package-clean/repositories/hadoopeng/hue/desktop/core/src/desktop/auth/views_test.py", line 474, in test_force_lower_case
    assert_equal(1, len(User.objects.all()), User.objects.all())
AssertionError: 1 != 2 : <QuerySet [<User: hue>, <User: test_remote_user_login>]>
-------------------- >> begin captured logging << --------------------
desktop.middleware: INFO: Unloading MimeTypeJSFileFixStreamingMiddleware
desktop.middleware: INFO: Unloading SpnegoMiddleware
desktop.middleware: INFO: Unloading ProxyMiddleware
access: DEBUG: 127.0.0.1 -anon- - "GET /hue/accounts/login/ HTTP/1.1" - (mem: 143mb)
desktop.middleware: WARNING: request.fs was not set
access: INFO: 127.0.0.1 -anon- - "GET /hue/accounts/login/ HTTP/1.1" returned in 15ms 200 117664 (mem: 143mb)
useradmin.models: INFO: Installed a user "{'username': 'hue'}"
root: DEBUG: GET None http://infra-hadoop-build1.dakao.io:43052/webhdfs/v1?user.name=hue&doas=hue&op=GETHOMEDIRECTORY  returned in 6ms 200 20 {"Path":"/user/hue"}
useradmin.models: INFO: Home directory already exists for user: hue
desktop.auth.backend: INFO: User test_remote_user_login was created.
axes.attempts: DEBUG: AXES: Skipping clean for expired access attempts because no AXES_COOLOFF_TIME is configured
axes.handlers.database: INFO: AXES: Successful login by {username: "test_remote_user_login", ip_address: "127.0.0.1", user_agent: "<unknown>", path_info: "/hue/accounts/login/"}.
access: DEBUG: 127.0.0.1 test_remote_user_login - "POST /hue/accounts/login/ HTTP/1.1" - (mem: 143mb)
hadoop.fs.upload: DEBUG: Chunk size = 67108864
access: WARNING: 127.0.0.1 test_remote_user_login - "POST /hue/accounts/login/ HTTP/1.1" - (mem: 143mb)-- Failed login for user: None
access: INFO: 127.0.0.1 test_remote_user_login - "POST /hue/accounts/login/ HTTP/1.1" returned in 50ms 200 152592 (mem: 143mb)
desktop.middleware: ERROR: Could not audit the request: [Errno 2] No such file or directory: '/var/log/hue/audit.log'
root: DEBUG: GET None http://infra-hadoop-build1.dakao.io:43052/webhdfs/v1//user/test_remote_user_login?user.name=hue&doas=test_remote_user_login&op=GETFILESTATUS  returned in 8ms 0 0
root: DEBUG: GET None http://infra-hadoop-build1.dakao.io:43052/webhdfs/v1//user/test_remote_user_login_2?user.name=hue&doas=test_remote_user_login&op=GETFILESTATUS  returned in 5ms 0 0
--------------------- >> end captured logging << ---------------------

I added debug message to assertion to check why User.objects.all() has 2 items instead 1. As you can see, it has two users [<User: hue>, <User: test_remote_user_login>], where the test expects <User: test_remote_user_login> only. Maybe remote login logic has been changed in python3 (or in django 3)?

Steps to reproduce it?

  • build hue with python3
  • run hue test specific desktop.auth.views_test.TestRemoteUserLogin

Hue version or source? (e.g. open source 4.5, CDH 5.16, CDP 1.0...). System info (e.g. OS, Browser...).
open source latest master branch

@romainr
Copy link
Contributor

romainr commented Aug 25, 2021

'hue' is a system user, there is probably some Py3 in the login view calling the install of it from install_sample_user.
(searching for Installed a user)

This might be a legit thing, we could either dig a bit more or update the test for py3.

useradmin.models: INFO: Installed a user "{'username': 'hue'}"

https://github.com/cloudera/hue/blob/master/desktop/core/src/desktop/auth/views.py#L105

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity and is not "roadmap" labeled or part of any milestone. Remove stale label or comment or this will be closed in 5 days.

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

No branches or pull requests

2 participants