Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8656B6137 for ; Wed, 15 Jun 2011 00:12:33 +0000 (UTC) Received: (qmail 2215 invoked by uid 500); 15 Jun 2011 00:12:33 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 2173 invoked by uid 500); 15 Jun 2011 00:12:33 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 2166 invoked by uid 99); 15 Jun 2011 00:12:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jun 2011 00:12:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jun 2011 00:12:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8865B23889B2; Wed, 15 Jun 2011 00:12:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1135864 - in /couchdb/branches/1.0.x: ./ etc/default/couchdb share/www/script/test/design_docs.js Date: Wed, 15 Jun 2011 00:12:08 -0000 To: commits@couchdb.apache.org From: davisp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110615001208.8865B23889B2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davisp Date: Wed Jun 15 00:12:08 2011 New Revision: 1135864 URL: http://svn.apache.org/viewvc?rev=1135864&view=rev Log: Backport of 1029025 from trunk. Closes COUCHDB-821. Improved the coverage and quality of the design_docs.js test. The actual issue (triggering a view indexation when invoking the view cleanup URI) was fixed in COUCHDB-858. Patch by Klaus Trainer. Thanks. Modified: couchdb/branches/1.0.x/ (props changed) couchdb/branches/1.0.x/etc/default/couchdb (props changed) couchdb/branches/1.0.x/share/www/script/test/design_docs.js Propchange: couchdb/branches/1.0.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jun 15 00:12:08 2011 @@ -6,4 +6,4 @@ /couchdb/branches/list-iterator:782292-784593 /couchdb/branches/tail_header:775760-778477 /couchdb/tags/0.10.0:825400 -/couchdb/trunk:984170,984178,984214,984228,984237,984241,984501,991073,1029030,1045203,1083714,1095557,1095581,1097300,1099479 +/couchdb/trunk:984170,984178,984214,984228,984237,984241,984501,991073,1029025,1029030,1045203,1083714,1095557,1095581,1097300,1099479 Propchange: couchdb/branches/1.0.x/etc/default/couchdb ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jun 15 00:12:08 2011 @@ -6,5 +6,5 @@ /couchdb/branches/list-iterator/etc/default/couchdb:782292-784593 /couchdb/branches/tail_header/etc/default/couchdb:775760-778477 /couchdb/tags/0.10.0/etc/default/couchdb:825400 -/couchdb/trunk/etc/default/couchdb:984170,984178,984214,984228,984237,984241,984501,991073,1029030,1045203,1083714,1095557,1095581,1097300,1099479 +/couchdb/trunk/etc/default/couchdb:984170,984178,984214,984228,984237,984241,984501,991073,1029025,1029030,1045203,1083714,1095557,1095581,1097300,1099479 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/1.0.x/share/www/script/test/design_docs.js URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/share/www/script/test/design_docs.js?rev=1135864&r1=1135863&r2=1135864&view=diff ============================================================================== --- couchdb/branches/1.0.x/share/www/script/test/design_docs.js (original) +++ couchdb/branches/1.0.x/share/www/script/test/design_docs.js Wed Jun 15 00:12:08 2011 @@ -96,33 +96,58 @@ function() { var prev_view_sig = db.designInfo("_design/test").view_index.signature; db.bulkSave(makeDocs(1, numDocs + 1)); + T(db.ensureFullCommit().ok); - // test that we get design doc info back - var dinfo = db.designInfo("_design/test"); - TEquals("test", dinfo.name); - var vinfo = dinfo.view_index; - TEquals(51, vinfo.disk_size); - TEquals(false, vinfo.compact_running); - // test that GET /db/_design/test/_info + // test that we get correct design doc info back, + // and also that GET /db/_design/test/_info // hasn't triggered an update of the views - TEquals(prev_view_sig, vinfo.signature, 'ddoc sig'); + db.view("test/summate", {stale: "ok"}); // make sure view group's open for (var loop = 0; loop < 2; loop++) { - T(db.view("test/all_docs_twice", {stale: "ok"}).total_rows === 0); - T(db.view("test/single_doc", {stale: "ok"}).total_rows === 0); - T(db.view("test/summate", {stale: "ok"}).rows.length === 0); + var dinfo = db.designInfo("_design/test"); + TEquals("test", dinfo.name); + var vinfo = dinfo.view_index; + TEquals(51, vinfo.disk_size); + TEquals(false, vinfo.compact_running); + TEquals(prev_view_sig, vinfo.signature, 'ddoc sig'); + // wait some time (there were issues where an update + // of the views had been triggered in the background) + var start = new Date().getTime(); + while (new Date().getTime() < start + 2000); + TEquals(0, db.view("test/all_docs_twice", {stale: "ok"}).total_rows, 'view info'); + TEquals(0, db.view("test/single_doc", {stale: "ok"}).total_rows, 'view info'); + TEquals(0, db.view("test/summate", {stale: "ok"}).rows.length, 'view info'); T(db.ensureFullCommit().ok); restartServer(); }; + db.bulkSave(makeDocs(numDocs + 1, numDocs * 2 + 1)); + T(db.ensureFullCommit().ok); + + // open view group + db.view("test/summate", {stale: "ok"}); + // wait so the views can get initialized + var start = new Date().getTime(); + while (new Date().getTime() < start + 2000); + // test that POST /db/_view_cleanup // doesn't trigger an update of the views - T(db.viewCleanup().ok); + var len1 = db.view("test/all_docs_twice", {stale: "ok"}).total_rows; + var len2 = db.view("test/single_doc", {stale: "ok"}).total_rows; + var len3 = db.view("test/summate", {stale: "ok"}).rows.length; for (var loop = 0; loop < 2; loop++) { - T(db.view("test/all_docs_twice", {stale: "ok"}).total_rows == 0); - T(db.view("test/single_doc", {stale: "ok"}).total_rows == 0); - T(db.view("test/summate", {stale: "ok"}).rows.length == 0); + T(db.viewCleanup().ok); + // wait some time (there were issues where an update + // of the views had been triggered in the background) + var start = new Date().getTime(); + while (new Date().getTime() < start + 2000); + TEquals(len1, db.view("test/all_docs_twice", {stale: "ok"}).total_rows, 'view cleanup'); + TEquals(len2, db.view("test/single_doc", {stale: "ok"}).total_rows, 'view cleanup'); + TEquals(len3, db.view("test/summate", {stale: "ok"}).rows.length, 'view cleanup'); T(db.ensureFullCommit().ok); restartServer(); + // we'll test whether the view group stays closed + // and the views stay uninitialized (they should!) + len1 = len2 = len3 = 0; }; // test that the _all_docs view returns correctly with keys @@ -155,7 +180,7 @@ function() { var summate = function(N) {return (N+1)*N/2;}; var result = db.view("test/summate"); - T(result.rows[0].value == summate(numDocs)); + T(result.rows[0].value == summate(numDocs*2)); result = db.view("test/summate", {startkey:4,endkey:4}); T(result.rows[0].value == 4);