You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2011/07/18 14:31:45 UTC

svn commit: r1147832 - in /couchdb/trunk/share/www: _sidebar.html style/layout.css verify_install.html

Author: jan
Date: Mon Jul 18 12:31:45 2011
New Revision: 1147832

URL: http://svn.apache.org/viewvc?rev=1147832&view=rev
Log:
Add a "Verify Installation" page to Futon.

The "verify install" procedure replaces	the full JS test suite for users
to see if they installation is correct. The tests run check for CouchDB's
basic feature set and should notify users of the most common installation
issues.

The full test suite is demoted to be "for Developers" in the sidebar, so
that core CouchDB developers can keep using this for development and
release testing, but end-users won't have to deal with the various
browser and runtime issues on different hardware.

Added:
    couchdb/trunk/share/www/verify_install.html
Modified:
    couchdb/trunk/share/www/_sidebar.html
    couchdb/trunk/share/www/style/layout.css

Modified: couchdb/trunk/share/www/_sidebar.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/_sidebar.html?rev=1147832&r1=1147831&r2=1147832&view=diff
==============================================================================
--- couchdb/trunk/share/www/_sidebar.html (original)
+++ couchdb/trunk/share/www/_sidebar.html Mon Jul 18 12:31:45 2011
@@ -23,7 +23,13 @@ specific language governing permissions 
       <li><a href="config.html">Configuration</a></li>
       <li><a href="replicator.html">Replicator</a></li>
       <li><a href="status.html">Status</a></li>
-      <li><a href="couch_tests.html?script/couch_tests.js">Test Suite</a></li>
+      <li><a href="verify_install.html">Verify Installation</a></li>
+      <li><hr/></li>
+      <li>For Developers:
+        <ul>
+          <li><a href="couch_tests.html?script/couch_tests.js">Test Suite</a></li>
+        </ul>
+      </li>
     </ul></li>
     <li><span>Recent Databases</span>
       <ul id="dbs"></ul>

Modified: couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/style/layout.css?rev=1147832&r1=1147831&r2=1147832&view=diff
==============================================================================
--- couchdb/trunk/share/www/style/layout.css (original)
+++ couchdb/trunk/share/www/style/layout.css Mon Jul 18 12:31:45 2011
@@ -562,6 +562,10 @@ body.loading #dialog h2 {
   background-image: url(../image/test_failure.gif) no-repeat; color: #c00;
 }
 
+#result {
+  color: #060;
+}
+
 /* Configuration */
 
 #config tbody th { background: #e6e6e6; border-right: none;

Added: couchdb/trunk/share/www/verify_install.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/verify_install.html?rev=1147832&view=auto
==============================================================================
--- couchdb/trunk/share/www/verify_install.html (added)
+++ couchdb/trunk/share/www/verify_install.html Mon Jul 18 12:31:45 2011
@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<!--
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+-->
+<html lang="en">
+  <head>
+    <title>Test Suite</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    <link rel="stylesheet" href="style/layout.css?0.11.0" type="text/css">
+    <script src="script/json2.js"></script>
+    <script src="script/sha1.js"></script>
+    <script src="script/jquery.js?1.4.2"></script>
+    <script src="script/jquery.couch.js?0.11.0"></script>
+    <script src="script/jquery.dialog.js?0.11.0"></script>
+    <script src="script/futon.js?0.11.0"></script>
+    <script src="script/couch.js?0.11.0"></script>
+    <script src="script/couch_test_runner.js?0.11.0"></script>
+    <script>
+    $(function($) {
+      $("#result").html("");
+      $("#run").click(verify_install);
+    });
+
+    function T(arg, desc) {
+      if(!arg) {
+        mesg = "Assertion failed" + (desc ? ": " + desc : "");
+        throw new Error(mesg);
+      }
+    }
+
+    function TEquals(expect, found, descr) {
+      var mesg = "expected '" + expect + "', got '" + found + "' " + descr;
+      T(expect === found, mesg);
+    }
+
+    function tests() {
+      var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
+
+      // cleanup, ignore the 404
+      try {db.deleteDb();} catch(e) {};
+      // create db
+      db.createDb();
+
+      // create document
+      var doc = {a:1};
+      var resp = db.save(doc);
+      TEquals(true, resp.ok, "save document");
+      // update document
+      doc.b = 2;
+      resp = db.save(doc);
+      TEquals(true, resp.ok, "update document");
+      TEquals(2, doc.b, "update document verified");
+      // delete document
+      resp = db.deleteDoc(doc);
+      TEquals(true, resp.ok, "delete document");
+      var doc2 = db.open(doc.id);
+      TEquals(doc2, null, "delete document verified");
+
+      // excercise query server
+      db.save({a:1});
+      db.save({a:2});
+      db.save({a:3});
+
+      //  temporary view
+      var resp = db.query(function(doc) {
+        if(doc.a) {
+          emit(doc.a, doc.a);
+        }
+      });
+      TEquals(3, resp.total_rows, "temp view query");
+
+      // replication
+      //   create second db
+      var db2 = new CouchDB("test_suite_db2", {"X-Couch-Full-Commit":"false"});
+      try {db2.deleteDb();} catch (e) {};
+      db2.createDb();
+      //   do replicate
+      CouchDB.replicate("test_suite_db", "test_suite_db2");
+      //   compare results
+      TEquals(db.info().doc_count, db2.info().doc_count, "databases are equal");
+    }
+
+    function verify_install() {
+      try {
+        var result = $("#result");
+        result.html("Running…");
+        tests();
+        result.html("√ Your installation looks fine. Time to Relax.");
+      } catch(e) {
+        console.log(e);
+        result.html("X: " + e);
+      }
+    }
+    </script>
+  </head>
+  <body><div id="wrap">
+    <h1>
+      <a href="index.html">Overview</a>
+      <strong>Verify Install</strong>
+    </h1>
+    <div id="content">
+      <ul id="toolbar">
+        <li><button class="run" id="run">Verify Your Installation.</button><span id="result"></span></li>
+      </ul>
+    </div>
+  </div></body>
+</html>