Return-Path: X-Original-To: apmail-cloudstack-issues-archive@www.apache.org Delivered-To: apmail-cloudstack-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 438D81859F for ; Wed, 3 Feb 2016 07:20:40 +0000 (UTC) Received: (qmail 55480 invoked by uid 500); 3 Feb 2016 07:20:40 -0000 Delivered-To: apmail-cloudstack-issues-archive@cloudstack.apache.org Received: (qmail 55436 invoked by uid 500); 3 Feb 2016 07:20:40 -0000 Mailing-List: contact issues-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 issues@cloudstack.apache.org Received: (qmail 55413 invoked by uid 500); 3 Feb 2016 07:20:39 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 55407 invoked by uid 99); 3 Feb 2016 07:20:39 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2016 07:20:39 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id CDD042C14F7 for ; Wed, 3 Feb 2016 07:20:39 +0000 (UTC) Date: Wed, 3 Feb 2016 07:20:39 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-9168) Testcase to check if wrong value is inserted into nics table netmask field when creating a VM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CLOUDSTACK-9168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15129949#comment-15129949 ] ASF GitHub Bot commented on CLOUDSTACK-9168: -------------------------------------------- Github user sanju1010 commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1245#discussion_r51685979 --- Diff: test/integration/testpaths/testpath_netmask.py --- @@ -0,0 +1,152 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +""" Test cases to Check Snapshots size in database +""" + +import re + +from nose.plugins.attrib import attr +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.lib.utils import (cleanup_resources, + ) +from marvin.lib.base import (Account, + ServiceOffering, + VirtualMachine, + ) +from marvin.lib.common import (get_domain, + get_zone, + get_template, + ) + + +class TestCheckNetmask(cloudstackTestCase): + + @classmethod + def setUpClass(cls): + testClient = super(TestCheckNetmask, cls).getClsTestClient() + cls.apiclient = testClient.getApiClient() + cls.testdata = testClient.getParsedTestDataConfig() + cls.hypervisor = cls.testClient.getHypervisorInfo() + + # Get Zone, Domain and templates + cls.domain = get_domain(cls.apiclient) + cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) + + cls.template = get_template( + cls.apiclient, + cls.zone.id, + cls.testdata["ostype"]) + + cls._cleanup = [] + + cls.skiptest = False + + if cls.hypervisor.lower() not in ["xenserver"]: + cls.skiptest = True + return + + try: + + # Create an account + cls.account = Account.create( + cls.apiclient, + cls.testdata["account"], + domainid=cls.domain.id + ) + cls._cleanup.append(cls.account) + + # Create user api client of the account + cls.userapiclient = testClient.getUserApiClient( + UserName=cls.account.name, + DomainName=cls.account.domain + ) + + # Create Service offering + cls.service_offering = ServiceOffering.create( + cls.apiclient, + cls.testdata["service_offering"], + ) + cls._cleanup.append(cls.service_offering) + + cls.vm = VirtualMachine.create( + cls.apiclient, + cls.testdata["small"], + templateid=cls.template.id, + accountid=cls.account.name, + domainid=cls.account.domainid, + serviceofferingid=cls.service_offering.id, + zoneid=cls.zone.id, + mode=cls.zone.networktype + ) + + except Exception as e: + cls.tearDownClass() + raise e + return + + @classmethod + def tearDownClass(cls): + try: + cleanup_resources(cls.apiclient, cls._cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + + def setUp(self): + if self.skiptest: + self.skipTest( + "Test not to be run on %s" % + self.hypervisor) + self.apiclient = self.testClient.getApiClient() + self.dbclient = self.testClient.getDbConnection() + self.cleanup = [] + + def tearDown(self): + try: + cleanup_resources(self.apiclient, self.cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + return + + @attr(tags=["basic"], required_hardware="false") + def test_01_netmask_value_check(self): + """ Check Netmask value in database + 1. Check if netmask attribute in nics table + stores correct value. + """ + + qryresult_netmask = self.dbclient.execute( --- End diff -- How can you make sure that this sql query would return the netmak belongs to the vm you had created? It is possible to have more than one isolated network with same CIDR. While running this test if there was already a vm created in a network with same CIDR, then this qurey would return multiple results. > Testcase to check if wrong value is inserted into nics table netmask field when creating a VM > --------------------------------------------------------------------------------------------- > > Key: CLOUDSTACK-9168 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9168 > Project: CloudStack > Issue Type: Task > Security Level: Public(Anyone can view this level - this is the default.) > Components: Automation > Affects Versions: 4.5.1 > Reporter: Priti Sarap > > Testcase to verify if netmask is inserted in correct format or not in nics table. -- This message was sent by Atlassian JIRA (v6.3.4#6332)