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

Investigate and fix the failure in test_copy_prebuilt_database

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • None
    • None
    • None

    Description

      Error Messageassert 0 == 10   -0   +10Stacktraceparams_from_base_test_setup = {'base_url': 'http://10.100.180.187:8080', 'cbl_ce': False, 'cbl_db': 'cbl-test1711139400.464994', 'cbl_log_decoder_build': None, ...}
      encrypted = False
       
          @pytest.mark.listener
          @pytest.mark.replication
          @pytest.mark.parametrize("encrypted", [
              False,
              True
          ])
          def test_copy_prebuilt_database(params_from_base_test_setup, encrypted):
              """
                  @summary:
                  1. Clean up the database/ Remove any existing database.
                  2. Copy the prebuilt database
                  3. Verify database is created successfully
                  4. Verify docs in prebuilt database are copied over and exits in current app
          
              """
          
              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"]
              liteserv_platform = params_from_base_test_setup["liteserv_platform"]
          
              prebuilt_doc_ids = ['cbl_2', 'cbl_1', 'cbl_3', 'cbl_4', 'cbl_0', 'cbl2_3', 'cbl2_0', 'cbl2_2', 'cbl2_4', 'cbl2_1']
          
              if sync_gateway_version < "2.0.0":
                  pytest.skip('This test cannnot run with sg version below 2.0')
          
              db_name = db.getName(cbl_db)
              db_path = db.getPath(cbl_db).rstrip("\\")
              db.deleteDB(cbl_db, db_name)
              cbl_db_name = "copiedDB" + str(time.time())
              if encrypted:
                  if 'c-' in liteserv_platform:
                      db_config = db.configureOld(password="password")
                  else:
                      db_config = db.configure(password="password")
                  db_prefix = "PrebuiltDB-encrypted"
              else:
                  db_config = db.configure()
                  db_prefix = "PrebuiltDB"
              if liteserv_platform in ["android", "xamarin-android", "java-macosx", "java-msft", "java-ubuntu", "java-centos",
                                       "javaws-macosx", "javaws-msft", "javaws-ubuntu", "javaws-centos"]:
                  prebuilt_db_path = "{}.cblite2.zip".format(db_prefix)
              elif liteserv_platform == "net-msft":
                  app_dir = "\\".join(db_path.split("\\")[:-2])
                  prebuilt_db_path = "{}\\Databases\\{}.cblite2".format(app_dir, db_prefix)
              else:
                  prebuilt_db_path = "Databases/{}.cblite2".format(db_prefix)
          
              old_db_path = db.get_pre_built_db(prebuilt_db_path)
              db.copyDatabase(old_db_path, cbl_db_name, db_config)
              cbl_db1 = db.create(cbl_db_name, db_config)
              cbl_doc_ids = db.getDocIds(cbl_db1)
      >       assert len(cbl_doc_ids) == 10
      E       assert 0 == 10
      E         -0
      E         +10 

      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:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty