Fix spelling, word case, duplicate words in code comments only (#8987)

This commit is contained in:
John Bampton 2024-04-30 18:58:26 +10:00 committed by GitHub
parent f41c934c94
commit db572f4478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 58 additions and 60 deletions

View File

@ -16,7 +16,7 @@
# under the License. # under the License.
""" P1 tests for testing resize volume functionality with primary storage """ P1 tests for testing resize volume functionality with primary storage
imit constraints on account/domain limit constraints on account/domain
Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/ Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/
Limit+Resources+to+domain+or+accounts Limit+Resources+to+domain+or+accounts
@ -254,7 +254,7 @@ class TestResizeVolume(cloudstackTestCase):
# 3. Deploy a VM without any disk offering (only root disk) # 3. Deploy a VM without any disk offering (only root disk)
# 4. Create a volume of 5 GB in the account and attach it to the VM # 4. Create a volume of 5 GB in the account and attach it to the VM
# 5. Try to (resize) the volume to 20 GB # 5. Try to (resize) the volume to 20 GB
# 6. Resize opearation should fail""" # 6. Resize operation should fail"""
# Setting up account and domain hierarchy # Setting up account and domain hierarchy
result = self.setupAccounts() result = self.setupAccounts()
@ -318,7 +318,7 @@ class TestResizeVolume(cloudstackTestCase):
# 3. Deploy a VM without any disk offering (only root disk) # 3. Deploy a VM without any disk offering (only root disk)
# 4. Create a volume of 5 GB in the account and attach it to the VM # 4. Create a volume of 5 GB in the account and attach it to the VM
# 5. Try to (resize) the volume to 20 GB # 5. Try to (resize) the volume to 20 GB
# 6. Resize opearation should fail""" # 6. Resize operation should fail"""
# Setting up account and domain hierarchy # Setting up account and domain hierarchy
result = self.setupAccounts() result = self.setupAccounts()

View File

@ -6,26 +6,26 @@ This directory contains the basic VM, Volume life cycle tests for Linstor storag
=============== ===============
To run the basic volume tests, first update the below test data of the CloudStack environment To run the basic volume tests, first update the below test data of the CloudStack environment
```` ```
TestData.zoneId: <id of zone> TestData.zoneId: <id of zone>
TestData.clusterId: <id of cluster> TestData.clusterId: <id of cluster>
TestData.domainId: <id of domain> TestData.domainId: <id of domain>
TestData.url: <management server IP> TestData.url: <management server IP>
TestData.primaryStorage "url": <Linstor storage pool url (see the format below) to use as primary storage> TestData.primaryStorage "url": <Linstor storage pool url (see the format below) to use as primary storage>
```` ```
and to enable and run volume migration tests, update the below test data and to enable and run volume migration tests, update the below test data
```` ```
TestData.migrationTests: True TestData.migrationTests: True
TestData.primaryStorageSameInstance "url": <Linstor url (see the format below) of the pool on same storage cluster as TestData.primaryStorage> TestData.primaryStorageSameInstance "url": <Linstor url (see the format below) of the pool on same storage cluster as TestData.primaryStorage>
TestData.primaryStorageDistinctInstance "url": <Linstor url (see the format below) of the pool not on the same storage cluster as TestData.primaryStorage> TestData.primaryStorageDistinctInstance "url": <Linstor url (see the format below) of the pool not on the same storage cluster as TestData.primaryStorage>
```` ```
Then run the tests using python unittest runner: nosetests Then run the tests using python unittest runner: nosetests
```` ```
nosetests --with-marvin --marvin-config=<marvin-cfg-file> <cloudstack-dir>/test/integration/plugins/linstor/test_linstor_volumes.py --zone=<zone> --hypervisor=kvm nosetests --with-marvin --marvin-config=<marvin-cfg-file> <cloudstack-dir>/test/integration/plugins/linstor/test_linstor_volumes.py --zone=<zone> --hypervisor=kvm
```` ```
You can also run these tests out of the box with PyDev or PyCharm or whatever. You can also run these tests out of the box with PyDev or PyCharm or whatever.

View File

@ -6,25 +6,25 @@ This directory contains the basic VM, Volume life cycle tests for PowerFlex/Scal
=============== ===============
To run the basic volume tests, first update the below test data of the CloudStack environment To run the basic volume tests, first update the below test data of the CloudStack environment
```` ```
TestData.zoneId: <id of zone> TestData.zoneId: <id of zone>
TestData.clusterId: <id of cluster> TestData.clusterId: <id of cluster>
TestData.domainId: <id of domain> TestData.domainId: <id of domain>
TestData.url: <management server IP> TestData.url: <management server IP>
TestData.primaryStorage "url": <PowerFlex/ScaleIO storage pool url (see the format below) to use as primary storage> TestData.primaryStorage "url": <PowerFlex/ScaleIO storage pool url (see the format below) to use as primary storage>
```` ```
and to enable and run volume migration tests, update the below test data and to enable and run volume migration tests, update the below test data
```` ```
TestData.migrationTests: True TestData.migrationTests: True
TestData.primaryStorageSameInstance "url": <PowerFlex/ScaleIO storage pool url (see the format below) of the pool on same storage cluster as TestData.primaryStorage> TestData.primaryStorageSameInstance "url": <PowerFlex/ScaleIO storage pool url (see the format below) of the pool on same storage cluster as TestData.primaryStorage>
TestData.primaryStorageDistinctInstance "url": <PowerFlex/ScaleIO storage pool url (see the format below) of the pool not on the same storage cluster as TestData.primaryStorage> TestData.primaryStorageDistinctInstance "url": <PowerFlex/ScaleIO storage pool url (see the format below) of the pool not on the same storage cluster as TestData.primaryStorage>
```` ```
PowerFlex/ScaleIO storage pool url format: PowerFlex/ScaleIO storage pool url format:
```` ```
powerflex://<api_user>:<api_password>@<gateway>/<storagepool> powerflex://<api_user>:<api_password>@<gateway>/<storagepool>
where, where,
@ -35,12 +35,12 @@ powerflex://<api_user>:<api_password>@<gateway>/<storagepool>
For example: "powerflex://admin:P%40ssword123@10.10.2.130/cspool" For example: "powerflex://admin:P%40ssword123@10.10.2.130/cspool"
```` ```
Then run the tests using python unittest runner: nosetests Then run the tests using python unittest runner: nosetests
```` ```
nosetests --with-marvin --marvin-config=<marvin-cfg-file> <cloudstack-dir>/test/integration/plugins/scaleio/test_scaleio_volumes.py --zone=<zone> --hypervisor=kvm nosetests --with-marvin --marvin-config=<marvin-cfg-file> <cloudstack-dir>/test/integration/plugins/scaleio/test_scaleio_volumes.py --zone=<zone> --hypervisor=kvm
```` ```
You can also run these tests out of the box with PyDev or PyCharm or whatever. You can also run these tests out of the box with PyDev or PyCharm or whatever.

View File

@ -112,7 +112,7 @@ class TestUsage(cloudstackTestCase):
if cls.zone.localstorageenable: if cls.zone.localstorageenable:
cls.testdata["service_offering"]["storagetype"] = 'local' cls.testdata["service_offering"]["storagetype"] = 'local'
# Create 2 service offerings with different values for # Create 2 service offerings with different values
# for cpunumber, cpuspeed, and memory # for cpunumber, cpuspeed, and memory
cls.testdata["service_offering"]["cpunumber"] = "1" cls.testdata["service_offering"]["cpunumber"] = "1"
@ -215,7 +215,7 @@ class TestUsage(cloudstackTestCase):
@classmethod @classmethod
def setUsageConfiguration(cls): def setUsageConfiguration(cls):
""" Set the configuration parameters so that usage job runs """ Set the configuration parameters so that usage job runs
every 10 miuntes """ every 10 minutes """
Configurations.update( Configurations.update(
cls.apiclient, cls.apiclient,
@ -434,7 +434,7 @@ class TestUsage(cloudstackTestCase):
# 1. Register a template and verify that usage is generated # 1. Register a template and verify that usage is generated
for correct size of template for correct size of template
# 2. Register an ISO, verify usage is generate for the correct size # 2. Register an ISO, verify usage is generated for the correct size
of ISO of ISO
# 3. Deploy a VM from the template and verify usage is generated # 3. Deploy a VM from the template and verify usage is generated
for the VM with correct Service Offering and template id for the VM with correct Service Offering and template id
@ -442,8 +442,8 @@ class TestUsage(cloudstackTestCase):
# 5. Stop and start the VM # 5. Stop and start the VM
# 6. Verify that allocated VM usage should be greater than # 6. Verify that allocated VM usage should be greater than
running VM usage running VM usage
# 7. Destroy the Vm and recover it # 7. Destroy the VM and recover it
# 8. Verify that the running VM usage stays the same after delete and # 8. Verify that the running VM usage stays the same after delete
and after recover operation and after recover operation
# 9. Verify that allocated VM usage should be greater after recover # 9. Verify that allocated VM usage should be greater after recover
operation than after destroy operation operation than after destroy operation
@ -453,7 +453,7 @@ class TestUsage(cloudstackTestCase):
# 12. Start the VM # 12. Start the VM
# 13. Verify that the running VM usage after start operation is less # 13. Verify that the running VM usage after start operation is less
than the allocated VM usage than the allocated VM usage
# 14. Verify that the running VM usage after start vm opearation # 14. Verify that the running VM usage after start VM operation
is greater running VM usage after recover VM operation is greater running VM usage after recover VM operation
""" """
@ -551,7 +551,7 @@ class TestUsage(cloudstackTestCase):
"Iso list validation failed" "Iso list validation failed"
) )
# Checking usage for Iso # Checking usage for ISO
response = self.listUsageRecords(usagetype=8) response = self.listUsageRecords(usagetype=8)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
isoUsageRecords = [record for record in response[1] isoUsageRecords = [record for record in response[1]
@ -824,7 +824,7 @@ class TestUsage(cloudstackTestCase):
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
vmAllocatedUsageRecord = response[1][-1] vmAllocatedUsageRecord = response[1][-1]
# Step 11: Veriying vm usage for new service offering # Step 11: Verifying VM usage for new service offering
self.assertEqual(vmAllocatedUsageRecord.offeringid, self.assertEqual(vmAllocatedUsageRecord.offeringid,
self.service_offering_2.id, self.service_offering_2.id,
"The service offering id in the usage record\ "The service offering id in the usage record\
@ -884,7 +884,7 @@ class TestUsage(cloudstackTestCase):
generated for template with correct size generated for template with correct size
# 7. Delete the template and verify that usage is stopped for # 7. Delete the template and verify that usage is stopped for
template template
# 8. Create volume from snaopshot and verify correct disk usage # 8. Create volume from snapshot and verify correct disk usage
is generated is generated
# 9. Delete the volume and verify that the usage is stopped # 9. Delete the volume and verify that the usage is stopped
# 10. Create template from snapshot and verify correct usage # 10. Create template from snapshot and verify correct usage
@ -1230,7 +1230,7 @@ class TestUsage(cloudstackTestCase):
# Step 7 # Step 7
templateFromVolume.delete(self.userapiclient) templateFromVolume.delete(self.userapiclient)
# Verifying usage for Template is stoppd after deleting it - START # Verifying usage for Template is stopped after deleting it - START
response = self.listUsageRecords(usagetype=7) response = self.listUsageRecords(usagetype=7)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
templateUsageRecords = response[1] templateUsageRecords = response[1]
@ -1256,7 +1256,7 @@ class TestUsage(cloudstackTestCase):
"usage for template after deletion should remain the same\ "usage for template after deletion should remain the same\
after specific intervals of time") after specific intervals of time")
# Verifying usage for Template is stoppd after deleting it - END # Verifying usage for Template is stopped after deleting it - END
# Step 8 # Step 8
self.testdata["volume_from_snapshot"]["zoneid"] = self.zone.id self.testdata["volume_from_snapshot"]["zoneid"] = self.zone.id
@ -1489,7 +1489,7 @@ class TestUsage(cloudstackTestCase):
usage is generated for account usage is generated for account
Also verify that IP usage is generated for source NAT IP of Also verify that IP usage is generated for source NAT IP of
network network
# 2. Enabled VPN on source nat IP of default network of VM # 2. Enabled VPN on source NAT IP of default network of VM
# 3. Add two VPN users and check that usage is generated for VPN users # 3. Add two VPN users and check that usage is generated for VPN users
# 4. Acquire public IP in the network and verify that IP usage # 4. Acquire public IP in the network and verify that IP usage
is generated for the acquired IP is generated for the acquired IP
@ -1532,7 +1532,7 @@ class TestUsage(cloudstackTestCase):
# Usages for steps are checked together in batch after the operations are done # Usages for steps are checked together in batch after the operations are done
# to avoid waiting for usage job to run for each operation separately # to avoid waiting for usage job to run for each operation separately
# Listing source nat ip of newly added network # Listing source NAT IP of newly added network
ipAddresses = PublicIPAddress.list( ipAddresses = PublicIPAddress.list(
self.apiclient, self.apiclient,
associatednetworkid=isolated_network.id, associatednetworkid=isolated_network.id,
@ -1548,7 +1548,7 @@ class TestUsage(cloudstackTestCase):
sourceNatIPDefaultNetwork = ipAddressesDefaultNetwork[0] sourceNatIPDefaultNetwork = ipAddressesDefaultNetwork[0]
# Step 2 # Step 2
# Create VPN for source NAT ip # Create VPN for source NAT IP
Vpn.create(self.apiclient, Vpn.create(self.apiclient,
sourceNatIPDefaultNetwork.id, sourceNatIPDefaultNetwork.id,
account=self.account.name, account=self.account.name,
@ -1625,7 +1625,7 @@ class TestUsage(cloudstackTestCase):
# Usages for above operations are checked here together # Usages for above operations are checked here together
# Checking usage for source nat IP of added network # Checking usage for source NAT IP of added network
response = self.listUsageRecords(usagetype=13) response = self.listUsageRecords(usagetype=13)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
usageRecords = response[1] usageRecords = response[1]
@ -1639,7 +1639,7 @@ class TestUsage(cloudstackTestCase):
self.assertTrue(float(nwOfferingUsageRecords[0].rawusage) > 0, self.assertTrue(float(nwOfferingUsageRecords[0].rawusage) > 0,
"Raw usage not started for source NAT ip") "Raw usage not started for source NAT ip")
# Checking usage for source nat IP of default VM network # Checking usage for source NAT IP of default VM network
response = self.listUsageRecords(usagetype=3, sleep=False) response = self.listUsageRecords(usagetype=3, sleep=False)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
usageRecords = response[1] usageRecords = response[1]
@ -1775,7 +1775,7 @@ class TestUsage(cloudstackTestCase):
) )
# Step 6 # Step 6
# Enabling static Nat for Ip Address associated # Enabling static NAT for IP Address associated
StaticNATRule.enable( StaticNATRule.enable(
self.userapiclient, self.userapiclient,
ipaddressid=public_ip_2.ipaddress.id, ipaddressid=public_ip_2.ipaddress.id,
@ -1933,7 +1933,7 @@ class TestUsage(cloudstackTestCase):
natRule_1_Usage_t1 == natRule_1_Usage_t2, natRule_1_Usage_t1 == natRule_1_Usage_t2,
"NAT rule usage should be stopped once the rule is deleted") "NAT rule usage should be stopped once the rule is deleted")
# Also verify that usage for other nat rule is running # Also verify that usage for other NAT rule is running
natRule_2_Usage_t1 = sum(float(record.rawusage) for record natRule_2_Usage_t1 = sum(float(record.rawusage) for record
in [record for record in usageRecords in [record for record in usageRecords
if nat_rule_2.id == record.usageid]) if nat_rule_2.id == record.usageid])
@ -1962,7 +1962,6 @@ class TestUsage(cloudstackTestCase):
is generated for the account is generated for the account
# 4. Create another LB rule with different ports and verify # 4. Create another LB rule with different ports and verify
separate usage is generated for new LB rule separate usage is generated for new LB rule
# 5. Create egress firewall rule for VM and SSH to VM # 5. Create egress firewall rule for VM and SSH to VM
# 6. Ping external network from the VM and verify that # 6. Ping external network from the VM and verify that
network byte usage is generated correctly network byte usage is generated correctly
@ -1972,12 +1971,11 @@ class TestUsage(cloudstackTestCase):
# Verify iptables counters are reset when domR stops # Verify iptables counters are reset when domR stops
# Verify current_bytes in user_statistics table are moved to # Verify current_bytes in user_statistics table are moved to
net_bytes net_bytes
# Verify currnt_bytes becomes zero # Verify current_bytes becomes zero
# 9. Start the router and # 9. Start the router and
# Verify iptables counters are reset when domR starts # Verify iptables counters are reset when domR starts
# Verify a diff of total (current_bytes + net_bytes) in previous # Verify a diff of total (current_bytes + net_bytes) in previous
aggregation period and current period will give the network usage aggregation period and current period will give the network usage
""" """
# Step 1 # Step 1
@ -2253,7 +2251,7 @@ class TestUsage(cloudstackTestCase):
""" Positive test for usage test path T61 - T62 """ Positive test for usage test path T61 - T62
Steps: Steps:
# 1. Deploy a VM # 1. Deploy a VM
# 2. Take Vm snapshot and verify usage is generated for VM snapshot # 2. Take VM snapshot and verify usage is generated for VM snapshot
# 3. Delete VM snapshot and verify that usage stops # 3. Delete VM snapshot and verify that usage stops
""" """
@ -2315,14 +2313,14 @@ class TestUsage(cloudstackTestCase):
@attr(tags=["advanced"], required_hardware="true") @attr(tags=["advanced"], required_hardware="true")
def test_06_positive_tests_usage(self): def test_06_positive_tests_usage(self):
"""Migrate VM and verify usage""" """Migrate VM and verify usage
# Validate the following # Validate the following
# 1. Create a VM, and verify that usage is generated for it # 1. Create a VM, and verify that usage is generated for it
# with correct service offering and template id # with correct service offering and template id
# 2. Migrate the VM to suitable host # 2. Migrate the VM to suitable host
# 3. Verify that after migration, VM usage continues to be running # 3. Verify that after migration, VM usage continues to be running
"""
if self.hypervisor.lower() in ['lxc']: if self.hypervisor.lower() in ['lxc']:
self.skipTest( self.skipTest(
"vm migrate feature is not supported on %s" % "vm migrate feature is not supported on %s" %
@ -2394,26 +2392,26 @@ class TestUsage(cloudstackTestCase):
""" """
Steps: Steps:
# 1. Add VM in VPC network, verify that # 1. Add VM in VPC network, verify that
# usage is generated for source nat ip pf network in vpc # usage is generated for source NAT IP pf network in VPC
# 2. Acquire a public ip in VPC network and verify # 2. Acquire a public IP in VPC network and verify
usage is generated for the public ip usage is generated for the public IP
# 3. Create multiple PF rule on this ip in VPC network, # 3. Create multiple PF rule on this IP in VPC network,
and verify that usage is generated for both pf rules and verify that usage is generated for both PF rules
# 4. Enable vpn on source nat ip in vpc network # 4. Enable VPN on source NAT IP in VPC network
# 5. Add 2 vpn user # 5. Add 2 VPN user
And verify that usage is generated for both the vpn users And verify that usage is generated for both the VPN users
# 6. Delete one VPn user, and verify that usage is stopped # 6. Delete one VPN user, and verify that usage is stopped
for deleted user for deleted user
# 7. Open Egress rules on this VPC network # 7. Open Egress rules on this VPC network
# 8. Create network traffic on this network ping www.google.com, # 8. Create network traffic on this network ping www.google.com,
and verify that usage is generated for network traffic and verify that usage is generated for network traffic
# 9. Delete onePF rule in VPC network # 9. Delete one PF rule in VPC network
And verify that usage is stopped for the pf rule And verify that usage is stopped for the PF rule
# 10. Stop router for VPC network # 10. Stop router for VPC network
Verify iptables counters are reset when domR stops Verify iptables counters are reset when domR stops
# Verify current_bytes in user_statistics table are moved to # Verify current_bytes in user_statistics table are moved to
net_bytes net_bytes
# Verify currnt_bytes becomes zero # Verify current_bytes becomes zero
# 11. Start router for VPC network # 11. Start router for VPC network
Verify iptables counters are reset when domR starts Verify iptables counters are reset when domR starts
# Verify a diff of total (current_bytes + net_bytes) in previous # Verify a diff of total (current_bytes + net_bytes) in previous
@ -2534,7 +2532,7 @@ class TestUsage(cloudstackTestCase):
sourceNatIP = ipAddresses[0] sourceNatIP = ipAddresses[0]
# Usage verification section # Usage verification section
# Checking source nat IP usage # Checking source NAT IP usage
response = self.listUsageRecords(usagetype=3) response = self.listUsageRecords(usagetype=3)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
usageRecords = response[1] usageRecords = response[1]
@ -2582,7 +2580,7 @@ class TestUsage(cloudstackTestCase):
"Raw usage not started for nat rule") "Raw usage not started for nat rule")
# Step 4: # Step 4:
# Create VPN for source NAT ip # Create VPN for source NAT IP
Vpn.create(self.apiclient, Vpn.create(self.apiclient,
sourceNatIP.id, sourceNatIP.id,
account=self.account.name, account=self.account.name,
@ -2884,7 +2882,7 @@ class TestUsage(cloudstackTestCase):
@attr(tags=["advanced", "basic"], required_hardware="false") @attr(tags=["advanced", "basic"], required_hardware="false")
def test_08_checkNewVolumein_listUsageRecords(self): def test_08_checkNewVolumein_listUsageRecords(self):
""" Test case to check if new volume crated after """ Test case to check if new volume created after
restore VM is listed in listUsageRecords restore VM is listed in listUsageRecords
# 1. Launch a VM # 1. Launch a VM
# 2. Restore the VM # 2. Restore the VM
@ -3063,7 +3061,7 @@ class TestUsageDirectMeteringBasicZone(cloudstackTestCase):
if cls.zone.localstorageenable: if cls.zone.localstorageenable:
cls.testdata["service_offering"]["storagetype"] = 'local' cls.testdata["service_offering"]["storagetype"] = 'local'
# Create 2 service offerings with different values for # Create 2 service offerings with different values
# for cpunumber, cpuspeed, and memory # for cpunumber, cpuspeed, and memory
cls.testdata["service_offering"]["cpunumber"] = "1" cls.testdata["service_offering"]["cpunumber"] = "1"
@ -3110,7 +3108,7 @@ class TestUsageDirectMeteringBasicZone(cloudstackTestCase):
domainid=self.domain.id domainid=self.domain.id
) )
self.cleanup.append(self.account) self.cleanup.append(self.account)
# Create user api client of the account # Create user API client of the account
self.userapiclient = self.testClient.getUserApiClient( self.userapiclient = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain DomainName=self.account.domain
@ -3261,7 +3259,7 @@ class TestUsageDirectMeteringBasicZone(cloudstackTestCase):
return return
def getLatestUsageJobExecutionTime(self): def getLatestUsageJobExecutionTime(self):
""" Get the end time of latest usage job that has run successfully""" """Get the end time of latest usage job that has run successfully"""
try: try:
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(