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

Investigate and fix test_initial_pull_replication_background_apprun

    XMLWordPrintable

Details

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

    Description

      The test is in:

       

      testsuites/CBLTester/CBL_Functional_tests/TestSetup_FunctionalTests/test_replication.py

       

      The failure:

       

      Error MessageTypeError: Object of type bytes is not JSON serializableStacktraceparams_from_base_test_setup = {'base_url': 'http://10.100.150.21:8080', 'cbl_ce': False, 'cbl_db': 'cbl-test1707612042.3031669', 'cbl_log_decoder_build': None, ...}
      num_docs = 1000, need_attachments = True
      replication_after_backgroundApp = False
       
          @pytest.mark.listener
          @pytest.mark.syncgateway
          @pytest.mark.replication
          @pytest.mark.backgroundapp
          @pytest.mark.parametrize("num_docs, need_attachments, replication_after_backgroundApp", [
              (1000, True, False),
              (1000, False, False),
              # (10000, False, True), # TODO : Not yet supported by Test server app
              # (1000, True, True) # TODO: Not yet supported by Test server app
          ])
          def test_initial_pull_replication_background_apprun(params_from_base_test_setup, num_docs, need_attachments,
                                                              replication_after_backgroundApp):
              """
              @summary
              1. Add specified number of documents to sync-gateway.
              2. Start continous pull replication to pull the docs from a sync_gateway database.
              3. While docs are getting replicated , push the app to the background
              4. Verify if all of the docs got pulled and replication completed when app goes background
              """
          
              sg_db = "db"
          
              cluster_config = params_from_base_test_setup["cluster_config"]
              sg_admin_url = params_from_base_test_setup["sg_admin_url"]
              sg_blip_url = params_from_base_test_setup["target_url"]
              liteserv_platform = params_from_base_test_setup["liteserv_platform"]
              device_enabled = params_from_base_test_setup["device_enabled"]
              cbl_db = params_from_base_test_setup["source_db"]
              base_url = params_from_base_test_setup["base_url"]
              testserver = params_from_base_test_setup["testserver"]
              sg_config = params_from_base_test_setup["sg_config"]
              need_sgw_admin_auth = params_from_base_test_setup["need_sgw_admin_auth"]
          
              if 'c' in liteserv_platform and (liteserv_platform.lower() != 'c-ios' or liteserv_platform != 'c-android'):
                  pytest.skip("Only implementation for iOS and android platforms")
              # No command to push the app to background on device, so avoid test to run on ios device and no app for .net
              if ((liteserv_platform.lower() == "ios" and device_enabled) or liteserv_platform.lower() == "xamarin-ios"):
                  pytest.skip('This test cannot run either it is .Net or ios with device enabled ')
          
              c = cluster.Cluster(config=cluster_config)
              c.reset(sg_config_path=sg_config),
          
              client = MobileRestClient()
              auth = need_sgw_admin_auth and (RBAC_FULL_ADMIN['user'], RBAC_FULL_ADMIN['pwd']) or None
              client.create_user(sg_admin_url, sg_db, "testuser", password="password", channels=["ABC", "NBC"], auth=auth)
              cookie, session_id = client.create_session(sg_admin_url, sg_db, "testuser", auth=auth)
              # session = cookie, session_id
              # Add 'number_of_sg_docs' to Sync Gateway
              bulk_docs_resp = []
              if need_attachments:
                  sg_doc_bodies = document.create_docs(
                      doc_id_prefix="seeded_doc",
                      number=num_docs,
                      attachments_generator=attachment.generate_2_png_10_10,
                      channels=["ABC"]
                  )
              else:
                  sg_doc_bodies = document.create_docs(doc_id_prefix='seeded_doc', number=num_docs, channels=["ABC"])
              # if adding bulk docs with huge attachment more than 5000 fails
              for x in range(0, len(sg_doc_bodies), 100000):
                  chunk_docs = sg_doc_bodies[x:x + 100000]
      >           ch_bulk_docs_resp = client.add_bulk_docs(url=sg_admin_url, db=sg_db, docs=chunk_docs, auth=auth) 

      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