Skip to content

Fix replication Javascript test#676

Merged
nickva merged 1 commit intoapache:masterfrom
cloudant:fix-replication-js-test
Jul 14, 2017
Merged

Fix replication Javascript test#676
nickva merged 1 commit intoapache:masterfrom
cloudant:fix-replication-js-test

Conversation

@nickva
Copy link
Contributor

@nickva nickva commented Jul 14, 2017

The test was flaky for a variety of reasons:

  • waitForSeq only waited for 3 seconds and on failure it never explitly
    indicated an error and just waited for the comparison below to fail. So made
    it wait for 30 seconds and also throw an exception right away if it fails.

  • Last waitForSeq was used after task was canceled. So it just wasted time
    waiting until timeout as the task was null. So created a function to
    wait for task to be null.

  • waitForSeq spun in a tight do/while loop querying _active_tasks. In some test
    environment with minimal CPU resources that's not the greatest thing to do.
    So made it wait for 0.5 seconds between retries.

  • waitForSeq waited for replication task's through_seq value to match source
    update sequence from source db info. Those don't necessarily match. Instead
    made waitForSeq use the changes feed last sequence since that's what the
    replication task uses to update through_seq.

The test was flaky for a variety of reasons:

 * waitForSeq only waited for 3 seconds and on failure it never explitly
   indicated an error and just waited for the comparison below to fail. So made
   it wait for 30 seconds and also throw an exception right away if it fails.

 * Last waitForSeq was used after task was canceled. So it just wasted time
   waiting until timeout as the task was null. So created a function to
   wait for task to be null.

 * waitForSeq spun in a tight do/while loop querying _active_tasks. In some test
   environment with minimal CPU resources that's not the greatest thing to do.
   So made it wait for 0.5 seconds between retries.

 * waitForSeq waited for replication task's through_seq value to match source
   update sequence from source db info. Those don't necessarily match. Instead
   made waitForSeq use the changes feed last sequence since that's what the
   replication task uses to update through_seq.
@nickva
Copy link
Contributor Author

nickva commented Jul 14, 2017

Tested on a CPU and disk resource constrained VM

CPU resources slowed down to 9% and disk throughput limit set at 100KB/sec

VBoxManage bandwidthctl ${VM} set Limit --limit 100KB

Seems to pass when before it failed:

 test/javascript/run replication.js
test/javascript/tests/replication.js   pass
=======================================================
JavaScript tests complete.
  Failed: 0.  Skipped or passed: 1.

@davisp
Copy link
Member

davisp commented Jul 14, 2017

+1

@nickva nickva merged commit a866f6c into apache:master Jul 14, 2017
@nickva nickva deleted the fix-replication-js-test branch July 14, 2017 16:14
@wohali
Copy link
Member

wohali commented Jul 16, 2017

Sadly we have a new failure scenario now. I'm going to reopen #634.

nickva pushed a commit to nickva/couchdb that referenced this pull request Sep 7, 2022
nickva pushed a commit to nickva/couchdb that referenced this pull request Sep 7, 2022
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

Successfully merging this pull request may close these issues.

3 participants