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

functional_tests: test HTTP digest authentication #9245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jeffro256
Copy link
Contributor

Test:

  1. Can't login to RPC server with --rpc-login enabled, but no auth provided
  2. Can access RPC server with correct login
  3. Can use internal HTTP client to access RPC server with correct login

With commit 0ae5c91 not reverted, we fail test 3.

Test:
  1. Can't login to RPC server with --rpc-login enabled, but no auth provided
  2. Can access RPC server with correct login
  3. Can use internal HTTP client to access RPC server with correct login

With commit 0ae5c91 not reverted, we fail test 3.
Copy link
Collaborator

@0xFFFC0000 0xFFFC0000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without reverting the 0ae5c91, it fails:

Attempting to connect to daemon loginless with RPC digest authentication required...
Attempting to connect to wallet server loginless with RPC digest authentication required...
Connecting to daemon with RPC digest authentication required...
Traceback (most recent call last):
  File "/home/xfffc/dev/monero-master/tests/functional_tests/http_digest_auth.py", line 110, in <module>
    HttpDigestAuthTest().run_test()
  File "/home/xfffc/dev/monero-master/tests/functional_tests/http_digest_auth.py", line 51, in run_test
    self.make_daemon_conn()
  File "/home/xfffc/dev/monero-master/tests/functional_tests/http_digest_auth.py", line 76, in make_daemon_conn
    self.daemon = Daemon(idx = DAEMON_IDX, username = DAEMON_USER, password = DAEMON_PASS)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Daemon.__init__() got an unexpected keyword argument 'username'
[TEST FAILED] http_digest_auth

Bue even after I reverted 0ae5c91, I still fail:

[TEST STARTED] http_digest_auth
Attempting to connect to daemon loginless with RPC digest authentication required...
Attempting to connect to wallet server loginless with RPC digest authentication required...
Connecting to daemon with RPC digest authentication required...
Traceback (most recent call last):
  File "/home/xfffc/dev/monero-master/tests/functional_tests/http_digest_auth.py", line 110, in <module>
    HttpDigestAuthTest().run_test()
  File "/home/xfffc/dev/monero-master/tests/functional_tests/http_digest_auth.py", line 51, in run_test
    self.make_daemon_conn()
  File "/home/xfffc/dev/monero-master/tests/functional_tests/http_digest_auth.py", line 76, in make_daemon_conn
    self.daemon = Daemon(idx = DAEMON_IDX, username = DAEMON_USER, password = DAEMON_PASS)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Daemon.__init__() got an unexpected keyword argument 'username'
[TEST FAILED] http_digest_aut

Tried this test separately, and still fails:

/usr/bin/python3 "/home/xfffc/dev/monero/tests/functional_tests/functional_tests_rpc.py" "/usr/bin/python3" "/home/xfffc/dev/monero/tests/functional_tests" "/home/xfffc/dev/monero/build" "http_digest_auth"

@jeffro256
Copy link
Contributor Author

Are you sure you included all the changes of this commit in that second run? That error would pop up if you only applied the changes to tests/functional_tests and not utils

@0xFFFC0000
Copy link
Collaborator

Apologies for my late reply.

After debugging the python script it turns out you should not have http_proxy and HTTP_PROXY environment variables when you are running functional_tests.

Without reverting the 0ae5c91:

6: [TEST STARTED] http_digest_auth
6: Attempting to connect to daemon loginless with RPC digest authentication required...
6: Attempting to connect to wallet server loginless with RPC digest authentication required...
6: Connecting to daemon with RPC digest authentication required...
6: Connecting to wallet server with RPC digest authentication required...
6: Telling login-required daemon to start mining through login-required wallet server...
6: Traceback (most recent call last):
6:   File "/home/0xfffc/dev/monero/tests/functional_tests/http_digest_auth.py", line 110, in <module>
6:     HttpDigestAuthTest().run_test()
6:   File "/home/0xfffc/dev/monero/tests/functional_tests/http_digest_auth.py", line 54, in run_test
6:     self.mine_through_wallet()
6:   File "/home/0xfffc/dev/monero/tests/functional_tests/http_digest_auth.py", line 92, in mine_through_wallet
6:     self.wallet.start_mining(2)
6:   File "/home/0xfffc/dev/monero/utils/python-rpc/framework/wallet.py", line 1065, in start_mining
6:     return self.rpc.send_json_rpc_request(start_mining)
6:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6:   File "/home/0xfffc/dev/monero/utils/python-rpc/framework/rpc.py", line 85, in send_json_rpc_request
6:     return self.send_request("/json_rpc", inputs, 'result')
6:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6:   File "/home/0xfffc/dev/monero/utils/python-rpc/framework/rpc.py", line 77, in send_request
6:     assert 'error' not in res, res
6: AssertionError: {'error': {'code': -1, 'message': "Couldn't start mining due to unknown error."}, 'id': '0', 'jsonrpc': '2.0'}
6: [TEST FAILED] http_digest_auth

I confirm with this PR, that we do not have functional_tests error if we revert 0ae5c91.

6: [TEST STARTED] http_digest_auth
6: Attempting to connect to daemon loginless with RPC digest authentication required...
6: Attempting to connect to wallet server loginless with RPC digest authentication required...
6: Connecting to daemon with RPC digest authentication required...
6: Connecting to wallet server with RPC digest authentication required...
6: Telling login-required daemon to start mining through login-required wallet server...
6: Waiting a few seconds for mining to occur...
6: Telling login-required daemon to stop mining through login-required wallet server...
6: Mined 13 blocks!
6: [TEST PASSED] http_digest_auth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants