Return-Path: X-Original-To: apmail-libcloud-dev-archive@www.apache.org Delivered-To: apmail-libcloud-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 4233AF389 for ; Fri, 22 Mar 2013 06:40:14 +0000 (UTC) Received: (qmail 34217 invoked by uid 500); 22 Mar 2013 06:40:14 -0000 Delivered-To: apmail-libcloud-dev-archive@libcloud.apache.org Received: (qmail 34073 invoked by uid 500); 22 Mar 2013 06:40:13 -0000 Mailing-List: contact dev-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list dev@libcloud.apache.org Delivered-To: moderator for dev@libcloud.apache.org Received: (qmail 63810 invoked by uid 99); 22 Mar 2013 01:22:39 -0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of johnmdcarr@me.com designates 17.172.204.237 as permitted sender) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8626,1.0.431,0.0.0000 definitions=2013-03-21_08:2013-03-21,2013-03-21,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=2 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1302030000 definitions=main-1303210221 From: John Carr Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: quoted-printable Message-id: <0FE0897F-2531-418F-915E-6DBAEF472A7A@me.com> Date: Fri, 22 Mar 2013 01:22:23 +0000 To: dev MIME-version: 1.0 (Mac OS X Mail 6.2 \(1499\)) X-Mailer: Apple Mail (2.1499) X-Virus-Checked: Checked by ClamAV on apache.org Subject: [dev] Improving tests Hi all, A while ago I opened a JIRA ticket for various test improvements I had = been thinking about: https://issues.apache.org/jira/browse/LIBCLOUD-289 It comes with some code, too. There were a few key points I wanted to address: * It is very easy to break things when refactoring. I've managed to = slip quite a few bugs past the tests and review so far, and this is = something I want to stop! Anything I can do to make the tests better at = spotting my bugs I have to do. * The tests don't enforce our interface. The danger here is that we = implement 50 compute abstractions that sort of work the same. For me, = subtle and surprising differences are worse than using multiple = different libraries. * The mocks should make more assertions. It's possible to calls a = server API but, for example, not pass any parameters and still have the = correct data returned! For the code referenced in the ticket: * There are a shared set of tests that all LB drivers (that I have = updated) use. This helps to pin down the interface and ensure all = drivers have the same behaviour. * Throws out static fixtures in favour of a mock that "works" =97 if = you call create twice and then list, you will see 2 records. * These mocks are checking much more - first of all that parameters are = actually transmitted to the server, and in the AWS case I do some checks = of the auth. The change in approach uncovered bugs and incompatible interfaces. For = example, some implementations are using strings for ports and some = integers. If memory serves (I wrote this at the start of feb) some use = both. Some return values are of different types.=20 The code isn't finished yet, but reached a point where I wanted some = feedback before continuing. Initially I was going to just update the = load balancers, and then DNS and others as separate tickets. Cheers, John