Uploaded image for project: 'Couchbase Mobile'
  1. Couchbase Mobile
  2. CM-1173

Investigate and fix the failure in test_verify_invalid_mask_password_in_logs

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None

    Description

      The failure:

       

      Error MessageException: 400 Client Error: Bad Request for url: http://10.100.180.135:8080/database_saveDocumentsjava.lang.reflect.InvocationTargetException  at java.lang.reflect.Method.invoke(Native Method)  at com.couchbase.mobiletestkit.javacommon.RequestHandlerDispatcher.handle(RequestHandlerDispatcher.java:138)  at com.couchbase.mobiletestkit.javalistener.Server.handle(Server.java:128)  at org.nanohttpd.protocols.http.HTTPSession.execute(HTTPSession.java:418)  at org.nanohttpd.protocols.http.ClientHandler.run(ClientHandler.java:75)  at java.lang.Thread.run(Thread.java:920) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.couchbase.lite.Database.inBatch(com.couchbase.lite.UnitOfWork)' on a null object reference  at com.couchbase.mobiletestkit.javacommon.RequestHandler.DatabaseRequestHandler.saveDocuments(DatabaseRequestHandler.java:178)  ... 6 moreStacktraceself = <CBLClient.Client.Client object at 0x7faa08c7dcd0>
      method = 'database_saveDocuments'
      args = <CBLClient.Args.Args object at 0x7faa08aba9d0>
      ignore_deserialize = False
       
          def invokeMethod(self, method, args=None, ignore_deserialize=False):
              resp = Response()
              try:
                  # Create body from args.
                  body = {}
          
                  url = self.base_url + "/" + method
          
                  if args:
                      for k, v in args:
                          val = ValueSerializer.serialize(v)
                          body[k] = val
                  # Create connection to method endpoint.
                  headers = {"Content-Type": "application/json"}
                  self.session.headers = headers
                  resp = self.session.post(url, data=json.dumps(body))
      >           resp.raise_for_status()
       
      CBLClient/Client.py:32: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       
      self = <Response [400]>
       
          def raise_for_status(self):
              """Raises stored :class:`HTTPError`, if one occurred."""
          
              http_error_msg = ''
              if isinstance(self.reason, bytes):
                  # We attempt to decode utf-8 first because some servers
                  # choose to localize their reason strings. If the string
                  # isn't utf-8, we fall back to iso-8859-1 for all other
                  # encodings. (See PR #3538)
                  try:
                      reason = self.reason.decode('utf-8')
                  except UnicodeDecodeError:
                      reason = self.reason.decode('iso-8859-1')
              else:
                  reason = self.reason
          
              if 400 <= self.status_code < 500:
                  http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
          
              elif 500 <= self.status_code < 600:
                  http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
          
              if http_error_msg:
      >           raise HTTPError(http_error_msg, response=self)
      E           requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://10.100.180.135:8080/database_saveDocuments
       
      venv/lib/python3.8/site-packages/requests/models.py:939: HTTPError
       
      During handling of the above exception, another exception occurred:
       
      params_from_base_test_setup = {'base_url': 'http://10.100.180.135:8080', 'cbl_ce': False, 'cbl_db': 'cbl-test1707474504.5997236', 'cbl_log_decoder_build': None, ...}
      invalid_password = 'auto password'
       
          @pytest.mark.listener
          @pytest.mark.replication
          @pytest.mark.parametrize("invalid_password", [
              "auto-password",
              "auto password",
              "invalidpassword",
          ])
          def test_verify_invalid_mask_password_in_logs(params_from_base_test_setup, invalid_password):
              """
                  @summary:
                  1. Create CBL DB and create bulk doc in CBL
                  2. Configure replication to Sg with basic authentication
                  3. Authenticate in CBL with invalid password
                  4. Verify invalid password is masked in cbl logs
              """
              sg_db = "db"
          
              sg_admin_url = params_from_base_test_setup["sg_admin_url"]
              sg_blip_url = params_from_base_test_setup["target_url"]
              base_url = params_from_base_test_setup["base_url"]
              cluster_config = params_from_base_test_setup["cluster_config"]
              sg_config = params_from_base_test_setup["sg_config"]
              db = params_from_base_test_setup["db"]
              cbl_db = params_from_base_test_setup["source_db"]
              sync_gateway_version = params_from_base_test_setup["sync_gateway_version"]
              log_file = params_from_base_test_setup["test_db_log_file"]
              liteserv_platform = params_from_base_test_setup["liteserv_platform"]
              enable_file_logging = params_from_base_test_setup["enable_file_logging"]
              test_cbllog = params_from_base_test_setup["test_cbllog"]
              need_sgw_admin_auth = params_from_base_test_setup["need_sgw_admin_auth"]
          
              num_cbl_docs = 50
              if sync_gateway_version < "2.0.0" and not enable_file_logging:
                  pytest.skip('This test cannot run with sg version below 2.0 or File logging is not enabled.')
          
              channels = ["ABC"]
              c = cluster.Cluster(config=cluster_config)
              c.reset(sg_config_path=sg_config)
          
              delete_tmp_logs()  # Clean up tmp logs before test runs
              replicator = Replication(base_url)
              authenticator = Authenticator(base_url)
          
              sg_client = MobileRestClient()
      >       db.create_bulk_docs(number=num_cbl_docs, id_prefix="cblid", db=cbl_db, channels=channels) 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            gilad.kalchheim Gilad Kalchheim
            gilad.kalchheim Gilad Kalchheim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty