rahulbcn27 commented on code in PR #7289:
URL: https://github.com/apache/cloudstack/pull/7289#discussion_r1151715157


##########
test/integration/smoke/test_vm_schedule.py:
##########
@@ -0,0 +1,177 @@
+# 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.
+
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import random_gen, cleanup_resources, validateList, 
is_snapshot_on_nfs, isAlmostEqual
+from marvin.cloudstackAPI import (deleteVMSchedule,
+                                  createVMSchedule,
+                                  listVMSchedules,
+                                  updateVMSchedule,
+                                  enableVMSchedule,
+                                  disableVMSchedule)
+
+from marvin.lib.base import * # import all resources like Account
+from marvin.lib.common import * # import all utility methods like get_zone etc.
+
+import time
+import os
+
+class Services:
+
+    """Test VM Schedule Services
+    """
+
+    def __init__(self):
+        self.services = {
+            "domain": {
+                "name": "Domain",
+            },
+            "vm_schedule": {
+                "virtualmachineid" : 9,
+                "description": "start vm",
+                "action": "start",
+                "schedule": "30",
+                "intervaltype": "HOURLY",
+                "tag": "hello",
+                "timezone": "Asia/Kolkata"
+            }
+        }
+
+class TestVmSchedule(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestVmSchedule, cls).getClsTestClient()
+        cls.apiclient = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get attributes
+        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+        cls.domain = get_domain(cls.apiclient)
+        cls.hypervisor = testClient.getHypervisorInfo()
+
+        cls.cleanup = []
+
+        template = get_suitable_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.services["ostype"],
+            cls.hypervisor
+        )
+
+        if template == FAILED:
+            assert False, "get_suitable_test_template() failed to return 
template\
+                    with description %s" % cls.services["ostype"]
+
+        cls.services["domainid"] = cls.domain.id
+        cls.services["small"]["zoneid"] = cls.zone.id
+        cls.services["templates"]["ostypeid"] = template.ostypeid
+        cls.services["zoneid"] = cls.zone.id
+
+        # Create VMs, NAT Rules etc
+        cls.account = Account.create(
+            cls.apiclient,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
+        cls.cleanup.append(cls.account)
+
+        cls.service_offering = ServiceOffering.create(
+            cls.apiclient,
+            cls.services["service_offerings"]["tiny"]
+        )
+        cls.cleanup.append(cls.service_offering)
+
+        cls.virtual_machine = VirtualMachine.create(
+            cls.apiclient,
+            cls.services["small"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id,
+            mode=cls.zone.networktype
+        )
+   #     cls.cleanup.append(cls.virtual_machine)
+
+    # Class's tearDown method, runs only once per test class after test cases
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to