Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF090F864 for ; Mon, 8 Apr 2013 19:56:55 +0000 (UTC) Received: (qmail 42127 invoked by uid 500); 8 Apr 2013 19:56:55 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 42099 invoked by uid 500); 8 Apr 2013 19:56:55 -0000 Mailing-List: contact dev-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 dev@couchdb.apache.org Received: (qmail 42091 invoked by uid 99); 8 Apr 2013 19:56:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 19:56:55 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of wendallc@83864.com designates 209.85.223.174 as permitted sender) Received: from [209.85.223.174] (HELO mail-ie0-f174.google.com) (209.85.223.174) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 19:56:51 +0000 Received: by mail-ie0-f174.google.com with SMTP id aq17so7547521iec.33 for ; Mon, 08 Apr 2013 12:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=83864.com; s=google; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=Q8Fp+veQ1RWSihMKsfVNZDzsKqn3t4tMhX+jMfZq6Ls=; b=QH0nAiLIM7GSTlvQ+B6QMwOLA4zD32fpgjBq2X3FPPl+jYwJFmdk+k36MLFhK/x69w 3gSjMeexGy6e+ZvcFm/MHNnv6Mk1NuLS4leY8E9YTkZVmNn7aanYzPDCUPku2escs/gp pebBNhodLongsjfVWqG/vVJH+A/DcnxcQ6iPY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding:x-gm-message-state; bh=Q8Fp+veQ1RWSihMKsfVNZDzsKqn3t4tMhX+jMfZq6Ls=; b=B3J4gvcDQtud/rWLrOg2cKbCc6w3loHAMP0kYH7vP9lBl7g9sC5L6iMTaBcPak4yMb fEmsrCTOE/qc3rVHuIW+U1ACD+QzBM8QDSOlKdD3tvs9lr0mFIZVZhZ7M/ecTBQhnGKa nT4MlD0tImmY8S/4OGn8vJ0SzvoKsR9VL7va+5ZLq84WwbUv7PqKjfr+A4qTngHO5ZXl JaPJuEd3iYoZfcHXWxu44iPq8gpYiM/xXibVY/qucmm6lwgCVPizf7RuzUWo74cILFWj skPvqHqo9dol4gwsEqGv09KAb5N6uRyucX2XlBlAwigPJ9xOgMT0PM5lpBVxsYGO3kkY O6cA== X-Received: by 10.50.178.36 with SMTP id cv4mr8410162igc.98.1365450986794; Mon, 08 Apr 2013 12:56:26 -0700 (PDT) Received: from wlaptop.localdomain (c-67-170-178-212.hsd1.or.comcast.net. [67.170.178.212]) by mx.google.com with ESMTPS id s8sm21088793igs.0.2013.04.08.12.56.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Apr 2013 12:56:24 -0700 (PDT) Sender: Wendall Cada Message-ID: <516320E4.9060805@apache.org> Date: Mon, 08 Apr 2013 12:56:20 -0700 From: Wendall Cada User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: dev@couchdb.apache.org Subject: Re: Javascript Test Suite References: <51535F0B.7060408@apache.org> <515F64E9.9050207@apache.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkVR4alphQyxIW3gmMJ8SP13HohcMMQqnlF3gUhcTEWBN5NTKQStDgiRIko0S5KhUySeeaA X-Virus-Checked: Checked by ClamAV on apache.org This looks like a really great start Dale. With most of the work already done in Javascript for these tests, it makes less sense to rewrite these in Python or Erlang. The advantage in having these written in Javascript at this point is that the tests are portable between different implementations such as PouchDB. Ideally, we could test Fauxton and CouchDB in the same way. Since Fauxton appears to be using Jasmine, I think it makes sense to standardize on that or similar. I'm not super concerned with refactoring the tests, as they should work as-is. Refactor would mostly be consistency and performance related. Wendall On 04/08/2013 07:41 AM, Dale Harvey wrote: > We have been looking to reuse the CouchDB javascript tests for PouchDB and > extracted them into a seperate npm package > > https://npmjs.org/package/couchdb-harness > > The idea was that we could reused the same test suite and throw ours away > however it hit a few problems, mostly that the test suite requires a sync > api (which caused most of the problems with xhr in the browser couch > tests), I spent a bunch of time converting the test suites to async, they > dont map 1-1 because the couch suite is quite imperative and not really > split into self contained unit tests. > > But already have 1000+ tests that test CouchDB, work on the command line > and reliably in the browser, I dont think they are suitable for couch right > now, but would be happy to do the work so we could share a test suite > > https://github.com/daleharvey/pouchdb/tree/master/tests > > > On 8 April 2013 15:26, Paul Davis wrote: > >> The first bit I'd like to say is that the use of couchjs was just a >> stop gap measure to get the test suite out of the browser. We used to >> have to deal with so many browser issues it was just a terrible mess. >> The issue with couchjs is much as you've seen that its not a very full >> environment for writing tests. So just to be clear that the only real >> thing tying us to that as a test platform is that we have a large >> amount of JS written already so either we need to make the couchjs >> better, use node, or translate tests to something that has a more >> useful environment. >> >> I've been noodling over whether we might be better off to just start >> translating everything to Python or something. I've seen suggestions >> for Erlang but I personally think Erlang is a terrible language for >> writing tests like this (specifically, the code to test ratio is >> ungood). If we had something like Python to hack on then I was also >> thinking of writing a library function that would start CouchDB as a >> slave process which then would remove the need to have the _restart >> handler because you could just kill -9 the subprocess and restart it >> with maybe a wait for when things boot again. >> >> I reviewed your feature branch the other day and I'm +1 for pushing >> that to master. >> >> Awesome work, Wendall. >> >> On Fri, Apr 5, 2013 at 6:57 PM, Wendall Cada wrote: >>> I wanted to follow up on this. >>> >>> I've created a feature branch for this and a JIRA issue >>> https://issues.apache.org/jira/browse/COUCHDB-1762 >>> >>> Overall, I think the worst problem is that the tests really aren't >>> debuggable in any sane way, and logging is essentially useless for most >>> things. The only sure way to spot an error most of the time is if it's an >>> actual CouchDB bug and shows up in the log. I'm not sure how this can >> ever >>> be fixed with the current test suite. I'd opt for testing with jasmine, >> but >>> that would require not using couchjs for the test runner, so for now, I >> just >>> focused on getting random failures under control. >>> >>> Paul was kind enough to share some code that he wrote recently to deal >> with >>> the rampant _restart issues. >>> >> https://github.com/davisp/couchdb/commit/0cbf6a9cea01eea599524bcdb77dedb322c7ade4 >>> This is a very sound approach in using a token so you can see if it >> actually >>> restarts. The current test suite can result in false positives very >> easily, >>> which leads to test failures. I think this is probably the biggest reason >>> for the random failures. In a previous IRC conversation with Bob >> (rnewson), >>> Jan and I think Benoit (sorry if not the case) _restart was deemed >> something >>> that should go away. I filed a ticket for it's removal >>> https://issues.apache.org/jira/browse/COUCHDB-1714, and as Bob points >> out in >>> the comments, this is useful for the test suite. I'd argue it's only >> useful >>> with Paul's patch adding a token. Otherwise, it's just not reliable at >> all. >>> For the branch I created, instead of using _restart, I did some bash >> magic >>> with a pipe and stop/start the process through the local run script. This >>> has the same drawback of not knowing if CouchDB restarted, or we just >> got a >>> false positive. To account for this, I put a small delay in the >> execution of >>> the lookup, using a new method isRunning to give a little time to stop. >>> >>> I also changed the suite to run a new couchjs for each test file. I'm not >>> certain at this point that this is even necessary at all, but I still >> think >>> it's safer in case of a crash, since the rest of the suite can continue. >>> >>> Other changes I made were just timing related in running the test suite >> for >>> spinning disks, and a couple bug fixes in individual tests. >>> >>> The lack of timers makes writing these tests very ugly. I really dislike >>> this, but so long as the test suite needs couchjs, I don't see a way to >>> avoid this without implementing our own setInterval method in C. >>> >>> One last item. I was getting a consistent failure in Centos 6. I tracked >>> this down to a bug in libcurl. For some reason, after any xhr request >> that >>> returns a 416, the very next send() will hang for a long time, then >>> eventually crash couchjs. The specific version causing the issue is >>> curl-7.19.7-35.el6 and libcurl-7.19.7-35.el6. I'm not certain if this is >>> worth reporting in JIRA, but it will certainly cause a test suite failure >>> consistently in attachment_ranges, but otherwise appears to be fairly >>> harmless. Maybe this should be documented somewhere? >>> >>> Wendall >>> >>> >>> On 03/27/2013 02:05 PM, Wendall Cada wrote: >>>> In 1.3.0, there is a new part of the test suite to run the javascript >>>> tests from the command line. I'm running into various issues on >> different >>>> hardware/OS configurations. Mostly, tests hanging or timing out and >> failing. >>>> These are really hard to troubleshoot, as they all pass just fine if run >>>> individually. >>>> >>>> What I'm experimenting with today is rewriting how the tests are >>>> implemented to be run one at a time from a loop in bash, versus a loop >> in >>>> javascript. I think the failures I'm running into are improper >>>> setup/teardown. There may be an issue with rapid delete and adding a >> db, or >>>> rapidly starting and stopping couchdb, but I think this is not what's >>>> happening in my failures. >>>> >>>> The nature of spidermonkey doesn't allow for spawning threads, or >>>> sandboxing, etc, so it's hard looking at the test suite to see how I can >>>> improve running all tests. I think it's far better to have the setup >> spawn a >>>> new interpreter for each test. Tear down will kill the interpreter. >>>> >>>> Wendall >>>