From f3a77c79e8ce5b6c1448737520a5c3e159e5337d Mon Sep 17 00:00:00 2001 From: Girish Shilamkar Date: Fri, 14 Feb 2014 14:27:13 +0530 Subject: [PATCH] CLOUDSTACK-5674: cls.fail does not work in setUpClass fixed it with assert. --- test/integration/smoke/test_affinity_groups.py | 2 +- test/integration/smoke/test_deploy_vm.py | 2 +- test/integration/smoke/test_deploy_vm_with_userdata.py | 2 +- .../smoke/test_deploy_vms_with_varied_deploymentplanners.py | 2 +- test/integration/smoke/test_internal_lb.py | 2 +- test/integration/smoke/test_loadbalance.py | 2 +- test/integration/smoke/test_multipleips_per_nic.py | 2 +- test/integration/smoke/test_network.py | 2 +- test/integration/smoke/test_network_acl.py | 2 +- test/integration/smoke/test_reset_vm_on_reboot.py | 2 +- test/integration/smoke/test_scale_vm.py | 2 +- test/integration/smoke/test_service_offerings.py | 2 +- test/integration/smoke/test_snapshots.py | 2 +- test/integration/smoke/test_templates.py | 4 ++-- test/integration/smoke/test_vm_life_cycle.py | 4 ++-- test/integration/smoke/test_vm_snapshots.py | 2 +- test/integration/smoke/test_volumes.py | 4 ++-- test/integration/smoke/test_vpc_vpn.py | 4 ++-- 18 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py index dab60b1b23a..75d9c48cd60 100644 --- a/test/integration/smoke/test_affinity_groups.py +++ b/test/integration/smoke/test_affinity_groups.py @@ -47,7 +47,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py index 9f40f78ad0a..7b0647b1400 100644 --- a/test/integration/smoke/test_deploy_vm.py +++ b/test/integration/smoke/test_deploy_vm.py @@ -49,7 +49,7 @@ class TestDeployVM(cloudstackTestCase): self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"]) if self.template == FAILED: - self.fail("get_template() failed to return template with description %s" % self.testdata["ostype"]) + self.fail("get_template() failed to return template with description %s" % self.testdata["ostype"] #create a user account self.account = Account.create( diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py index eb03194db3a..bcef01aa274 100644 --- a/test/integration/smoke/test_deploy_vm_with_userdata.py +++ b/test/integration/smoke/test_deploy_vm_with_userdata.py @@ -53,7 +53,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.debug("Successfully created account: %s, id: \ %s" % (cls.account.name,\ diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py index c0c77e78bef..afc9802b661 100644 --- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py +++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py @@ -42,7 +42,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase): ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert false, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["template"] = cls.template.id diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py index 8a64b4dc12c..b25c404787b 100644 --- a/test/integration/smoke/test_internal_lb.py +++ b/test/integration/smoke/test_internal_lb.py @@ -48,7 +48,7 @@ class TestInternalLb(cloudstackTestCase): ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.debug("Successfully created account: %s, id: \ %s" % (cls.account.name,\ diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py index 28a14e4420f..37a11f6ae71 100644 --- a/test/integration/smoke/test_loadbalance.py +++ b/test/integration/smoke/test_loadbalance.py @@ -45,7 +45,7 @@ class TestLoadBalance(cloudstackTestCase): cls.services["ostype"] ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["server"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py index 9c7f2f75a38..4d0fbf432de 100644 --- a/test/integration/smoke/test_multipleips_per_nic.py +++ b/test/integration/smoke/test_multipleips_per_nic.py @@ -53,7 +53,7 @@ class TestDeployVM(cloudstackTestCase): self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"]) if self.template == FAILED: - self.fail("get_template() failed to return template with description %s" % self.testdata["ostype"]) + assert False, "get_template() failed to return template with description %s" % self.testdata["ostype"] #create a user account self.account = Account.create( diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index 258d2546cd2..1e9ff801c09 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -240,7 +240,7 @@ class TestPortForwarding(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] #Create an account, network, VM and IP addresses cls.account = Account.create( diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py index 1133bee0af1..f42ef46fea9 100644 --- a/test/integration/smoke/test_network_acl.py +++ b/test/integration/smoke/test_network_acl.py @@ -46,7 +46,7 @@ class TestNetworkACL(cloudstackTestCase): ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.debug("Successfully created account: %s, id: \ %s" % (cls.account.name,\ diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py index 253f0f4aaf9..284df0c61f5 100644 --- a/test/integration/smoke/test_reset_vm_on_reboot.py +++ b/test/integration/smoke/test_reset_vm_on_reboot.py @@ -45,7 +45,7 @@ class TestResetVmOnReboot(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]) # Set Zones and disk offerings ?? cls.services["small"]["zoneid"] = zone.id diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py index 5ab4463e312..2e038eca021 100644 --- a/test/integration/smoke/test_scale_vm.py +++ b/test/integration/smoke/test_scale_vm.py @@ -45,7 +45,7 @@ class TestScaleVm(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] # Set Zones and disk offerings ?? cls.services["small"]["zoneid"] = zone.id diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py index 0c7752d1bbd..809188c6d23 100644 --- a/test/integration/smoke/test_service_offerings.py +++ b/test/integration/smoke/test_service_offerings.py @@ -154,7 +154,7 @@ class TestServiceOfferings(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] # Set Zones and disk offerings cls.services["small"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py index d475d87059c..50065012b71 100644 --- a/test/integration/smoke/test_snapshots.py +++ b/test/integration/smoke/test_snapshots.py @@ -41,7 +41,7 @@ class TestSnapshotRootDisk(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + self.assert "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["domainid"] = cls.domain.id cls.services["server_without_disk"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index 26bbb5504d1..a2ac662a861 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -71,7 +71,7 @@ class TestCreateTemplate(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["template"]["ostypeid"] = template.ostypeid cls.services["template_2"]["ostypeid"] = template.ostypeid @@ -249,7 +249,7 @@ class TestTemplates(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["volume"]["diskoffering"] = cls.disk_offering.id diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index 05ecba5a7f0..db144b6b343 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -55,7 +55,7 @@ class TestDeployVM(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] # Set Zones and disk offerings cls.services["small"]["zoneid"] = cls.zone.id @@ -216,7 +216,7 @@ class TestVMLifeCycle(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] # Set Zones and disk offerings cls.services["small"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py index 6f64802701f..f3625ee365a 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -40,7 +40,7 @@ class TestVmSnapshot(cloudstackTestCase): cls.services["ostype"] ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["domainid"] = cls.domain.id cls.services["server"]["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index 70172ca119b..6610b79fdae 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -61,7 +61,7 @@ class TestCreateVolume(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["domainid"] = cls.domain.id cls.services["zoneid"] = cls.zone.id @@ -244,7 +244,7 @@ class TestVolumes(cloudstackTestCase): cls.services["ostype"] ) if template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.services["domainid"] = cls.domain.id cls.services["zoneid"] = cls.zone.id diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py index 4ec2da11dae..11531d12043 100644 --- a/test/integration/smoke/test_vpc_vpn.py +++ b/test/integration/smoke/test_vpc_vpn.py @@ -47,7 +47,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase): cls.services["ostype"] ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.cleanup = [cls.account] @@ -154,7 +154,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase): cls.services["ostype"] ) if cls.template == FAILED: - cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"]) + assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] cls.cleanup = [cls.account]