Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-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 1CE33105BA for ; Wed, 24 Jul 2013 20:46:02 +0000 (UTC) Received: (qmail 95812 invoked by uid 500); 24 Jul 2013 20:46:01 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 95776 invoked by uid 500); 24 Jul 2013 20:46:01 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 95768 invoked by uid 99); 24 Jul 2013 20:46:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2013 20:46:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.212.43] (HELO mail-vb0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2013 20:45:55 +0000 Received: by mail-vb0-f43.google.com with SMTP id e12so6700658vbg.30 for ; Wed, 24 Jul 2013 13:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=RnwY6uyXc/YWzPJ/ylqSvbdYNlUOyafZu3WLzjGbgZk=; b=Flkn9W+QhLj0+jAlcTAUUf4fhDFT6yrbJE57CHjsX5nhEN8FpWveTrUQ0MeKSMPKPK 2teDYEWLftaPAU2seFvHdKdyUyPgrgjOVMi+T8QDLcNkPADzDDzYaNTZhaNT0NJoa5Km 8Yod30shO/2vLGIS2c2isXOrzd5byv4d3Yio+73ylh5RpdNcJAcQlt5a9CHvDLXKamiA cmHsYQAO8TLx5U0++n757f23uO5BDPEmg7HpSlspi7oemDvEHzkz5ImJM/dkFk0pT38A iDgh3+ovMs5cDzWvtwbhUvwTiceyZ3frCQKM5Ae8GoXGRw26C2U2f6Etg0WRDZn5Ffl3 ONyQ== MIME-Version: 1.0 X-Received: by 10.52.0.52 with SMTP id 20mr13092595vdb.22.1374698713546; Wed, 24 Jul 2013 13:45:13 -0700 (PDT) Received: by 10.58.218.33 with HTTP; Wed, 24 Jul 2013 13:45:13 -0700 (PDT) X-Originating-IP: [63.110.51.11] In-Reply-To: <20130724065409.GA7695@cloud-2.local> References: <20130724055647.GA5851@cloud-2.local> <20130724065409.GA7695@cloud-2.local> Date: Wed, 24 Jul 2013 13:45:13 -0700 Message-ID: Subject: Re: Automated Tests: Account Cleanup in test modules From: Sheng Yang To: "" Content-Type: multipart/alternative; boundary=047d7bacbce87e931704e247fc08 X-Gm-Message-State: ALoCoQlJLpG2Dpgg9uL6Ud9kUbX4E7H1+G3jNBaMMp5bz0rVC8+h1tH9Mmz2oM0jqpZ4iSyC0UPY X-Virus-Checked: Checked by ClamAV on apache.org --047d7bacbce87e931704e247fc08 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jul 23, 2013 at 11:54 PM, Prasanna Santhanam wrote: > On Tue, Jul 23, 2013 at 11:20:22PM -0700, Sheng Yang wrote: > > About the patch I committed, in fact it's not moving. It's fixing. > Because: > > 1. The logical reason is, currently in many cases(which I committed the > > patches) the account is already create per test case rather than per > > module. And if account is created in setUp() rather than setUpClass(), > the > > clean up would be in tearDown() rather than tearDownClass(), because > > they're useless anyway after setUp create another account and more VMs. > My > > patch didn't move account creation from setUpClass(). > > Sheng - thanks I saw your patches more clearly now. The diffs mislead > me that they were perhaps moved. You're right that the cleanup > list should add the account in the locality of where it was created ie > per-test or per-module as the case may be. > > > 2. The more direct reason is too many test cases in regression test > failed > > just because lack of resource to create new deployment. E.g. > > https://issues.apache.org/jira/browse/CLOUDSTACK-3643 . Whenever I saw > > "Fail to create VPC" or "Fail to deploy VM", mostly it because the > testing > > setup is overloaded. > > Yes this is a concern. We are mislead by resource exhaustion to be a > failure in the test. Do you think the tests could be better organized > when run in a group against a limited resource deployment? > I can think of following things: 1. The maximum parallel execution test cases number should leave some(but not too much) margin for wrong test cases. 2. Every test case should take care of it's own resources and release them ASAP after they're no longer in use. 3. Reduce the time out for failure operation. E.g. we don't need to wait tens of minutes for SSH timeout. 4. Check for unnecessary and duplicate test cases. If we can get test cases running faster, then they can release the resources sooner. > > > > I know VM creating is very time consuming, and reuse the account and VM > is > > really nice! But the fact is many of current test cases is not written in > > this way. So I think we should release the resource as soon as it's > > obsolete. > > > Yup that's the way it was intended. We probably deviated from there > and will fix these tests during this sprint. > > > About reusing the already deployed VM and account, it would be a > > case-by-case issue. For example, TestAddVmToSubDomain case in > test_accounts > > do create the two VMs shared across the module(class), then tear it down > > when in tearDownClass(). But sometime there is not a easy way to do so. I > > think that's why there are not many VirtualMachine.create() happened in > > setUpClass(). > > > > Agreed on this. Much of this information is within the test cases and > until you drill down in the scenario you won't be aware of it. But > in general the guidelines probably were not clear (I got questions > from others working on the tests) so it was better to spell them out. > > It's time to write up these guidelines in our wiki which has some > basic guidelines already: > > https://cwiki.apache.org/confluence/display/CLOUDSTACK/Marvin+-+Testing+with+Python#Marvin-TestingwithPython-Guidelinestochoosescenariosforintegration Yes, I've add some clean up guideline to it. --Sheng > > > Thanks for sharing your thoughts, > > > > --Sheng > > > > > > On Tue, Jul 23, 2013 at 10:56 PM, Prasanna Santhanam > wrote: > > > > > In the test modules when you debug you will notice that accounts are > > > created once per module in setUpClass() all resources created within > > > it and tearDownClass() destroys the account initiating cleanup. All > > > the resources are appended to a cleanup [] list and deleted in > > > appropriate order at the end of the test module in tearDownClass() > > > > > > There are a few reasons for doing this for all the tests in the class > > > at once as opposed to doing it for every test. > > > > > > Modules are grouped by feature eg: test_tags does tags related > > > tests. And more often than not all tests in the module share similar > > > patterns in the set of API calls made to achieve a test scenario. > > > > > > If an account was created per test the overhead of cleaning up is much > > > higher than when cleaning up once per module. Because every new > > > account needs a new VR for the first VM deployed in it. And almost > > > every test will deploy a VM. So this slows down test run significantly > > > and eats up resources like VLANs very quickly which are needed for > > > every account. > > > > > > I saw a few fixes that moved the resource cleanup from tearDownClass() > > > to tearDown and that prompted me to send this email. Hope this makes > > > sense. I'd like to hear other's thoughts on how best to accomplish all > > > the tests in the most optimum way without hurting resources on a > > > deployment. > > > > > > Also - on the test infrastructure on jenkins.buildacloud.org there is > > > no way to timeout a specific test if it takes up more time than > > > necessary. So I'm going to introduce a timeout plugin in nose that > > > will abort the test if it takes longer than 1/2hr. I think this should > > > help weeding out test that do arbitrary 'sleeps' or wait for very long > > > cleanup operations. That way we should be able to optimize the test as > > > well > > > > > > Thoughts? > > > > > > -- > > > Prasanna., > > > > > > ------------------------ > > > Powered by BigRock.com > > > > > > > > -- > Prasanna., > > ------------------------ > Powered by BigRock.com > > --047d7bacbce87e931704e247fc08--