def tearDownClass(self):
        ctx = self.mock_ctx("del")
        ctx.logger.info("DELETE subnet's required resources")

        ctx.logger.info("DELETE resource_group")
        current_ctx.set(ctx=ctx)
        resource_group.delete(ctx=ctx)
    def test_delete_resource_group(self):
        ctx = self.mock_ctx('testdeletegroup')
        current_ctx.set(ctx=ctx)
        ctx.logger.info("BEGIN resource_group delete test")

        ctx.logger.info("create resource_group")
        status_code = resource_group.create(ctx=ctx)
        ctx.logger.debug("status_code = " + str(status_code) )
        self.assertTrue(bool((status_code == 200) or (status_code == 201)))
        current_ctx.set(ctx=ctx)
        utils.wait_status(ctx, "resource_group",constants.SUCCEEDED, timeout=600)      

        current_ctx.set(ctx=ctx)
        ctx.logger.info("delete resource_group")
        self.assertEqual(202, resource_group.delete(ctx=ctx))

        try:
            current_ctx.set(ctx=ctx)
            utils.wait_status(ctx, "resource_group","waiting for exception", timeout=600)
        except utils.WindowsAzureError:
            pass


        ctx.logger.info("create resource_group with deletable propertie set to false")
        ctx.node.properties[constants.DELETABLE_KEY] = False
        status_code = resource_group.create(ctx=ctx)
        ctx.logger.debug("status_code = " + str(status_code) )
        self.assertTrue(bool((status_code == 200) or (status_code == 201)))
        current_ctx.set(ctx=ctx)
        utils.wait_status(ctx, "resource_group",constants.SUCCEEDED, timeout=600)  

        ctx.logger.info("not delete resource_group")
        current_ctx.set(ctx=ctx)
        self.assertEqual(0, resource_group.delete(ctx=ctx))
        
        ctx.logger.info("delete resource_group")
        ctx.logger.info("Set deletable propertie to True")
        current_ctx.set(ctx=ctx)
        ctx.node.properties[constants.DELETABLE_KEY] = True
        self.assertEqual(202, resource_group.delete(ctx=ctx))

        try:
            current_ctx.set(ctx=ctx)
            utils.wait_status(ctx, "resource_group","waiting for exception", timeout=600)
        except utils.WindowsAzureError:
            pass

        ctx.logger.info("END resource_group delete test")
    def test_conflict_resource_group(self):
        ctx = self.mock_ctx('conflictgroup')
        current_ctx.set(ctx=ctx)
        ctx.logger.info("BEGIN resource_group conflict test")
        ctx.logger.info("create resource group")
        status_code = resource_group.create(ctx=ctx)
        ctx.logger.debug("status_code = " + str(status_code) )
        self.assertTrue(bool((status_code == 200) or (status_code == 201)))
        current_ctx.set(ctx=ctx)
        utils.wait_status(ctx, "resource_group",constants.SUCCEEDED, timeout=600)    

        ctx.logger.info("conflict create resource group")
        status_code = resource_group.create(ctx=ctx)
        ctx.logger.debug("status_code = " + str(status_code) )
        self.assertTrue(bool((status_code == 200) or (status_code == 201)))

        ctx.logger.info("delete resource_group")
        current_ctx.set(ctx=ctx)
        self.assertEqual(202, resource_group.delete(ctx=ctx))
        
        try:
            current_ctx.set(ctx=ctx)
            utils.wait_status(ctx, "resource_group","waiting for exception", timeout=600)
        except utils.WindowsAzureError:
            pass

        ctx.logger.info("END resource_group conflict test")
Exemplo n.º 4
0
 def tearDownClass(self):
     ctx = self.mock_ctx('init')
     ctx.logger.info("DELETE NIC\'s required resources")
     current_ctx.set(ctx=ctx)
     resource_group.delete(ctx=ctx)
 def tearDownClass(self):
     ctx = self.mock_ctx('del')
     ctx.logger.info("DELETE storage_account\'s required resources")
     current_ctx.set(ctx=ctx)
     resource_group.delete(ctx=ctx)
 def tearDownClass(self):
     ctx = self.mock_ctx('del')
     ctx.logger.info("DELETE availability set required resources")
     current_ctx.set(ctx=ctx)
     resource_group.delete(ctx=ctx)
 def tearDownClass(self):
     ctx = self.mock_ctx('del')
     current_ctx.set(ctx=ctx)
     ctx.logger.info("DELETE resource_group")
     resource_group.delete(ctx=ctx)