Skip to content

Commit

Permalink
Fixed vs migrate unit tests. Fixed #2123
Browse files Browse the repository at this point in the history
  • Loading branch information
allmightyspiff committed Oct 7, 2024
1 parent 4e81748 commit b41158b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "^.secrets.baseline$",
"lines": null
},
"generated_at": "2024-10-04T22:18:14Z",
"generated_at": "2024-10-07T21:05:06Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -112,15 +112,15 @@
"hashed_secret": "6367c48dd193d56ea7b0baad25b19455e529f5ee",
"is_secret": false,
"is_verified": false,
"line_number": 121,
"line_number": 122,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "df51e37c269aa94d38f93e537bf6e2020b21406c",
"is_secret": false,
"is_verified": false,
"line_number": 1035,
"line_number": 1036,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down
4 changes: 2 additions & 2 deletions SoftLayer/CLI/virt/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def cli(env, guest, migrate_all, host):
require_table = formatting.Table(['id', 'hostname', 'domain', 'datacenter'], title="Require Migration")

for vsi_object in require_migration:
if vsi_object['pendingMigrationFlag']:
if vsi_object.get('pendingMigrationFlag', False):
require_table.add_row([
vsi_object.get('id'),
vsi_object.get('hostname'),
Expand Down Expand Up @@ -65,7 +65,7 @@ def cli(env, guest, migrate_all, host):
require_migration = vsi.list_instances(mask="mask[id,pendingMigrationFlag]")
migrated = 0
for vsi_object in require_migration:
if vsi_object['pendingMigrationFlag']:
if vsi_object.get('pendingMigrationFlag', False):
migrated = migrated + 1
migrate(vsi, vsi_object['id'])
if migrated == 0:
Expand Down
3 changes: 2 additions & 1 deletion SoftLayer/fixtures/SoftLayer_Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'globalIdentifier': '1a2b3c-1701',
'primaryBackendIpAddress': '10.45.19.37',
'hourlyBillingFlag': False,

'pendingMigrationFlag': True,
'billingItem': {
'id': 6327,
'recurringFee': 1.54,
Expand Down Expand Up @@ -63,6 +63,7 @@
'globalIdentifier': '05a8ac-6abf0',
'primaryBackendIpAddress': '10.45.19.35',
'hourlyBillingFlag': True,
'pendingMigrationFlag': True,
'billingItem': {
'id': 6327,
'recurringFee': 1.54,
Expand Down
4 changes: 2 additions & 2 deletions tests/managers/vs/vs_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def test_list_instances_with_filters(self):

_filter = {
'virtualGuests': {
'id': {'operation': 'orderBy', 'options': [{'name': 'sort', 'value': ['ASC']}]},
'datacenter': {
'name': {'operation': '_= dal05'}},
'domain': {'operation': '_= example.com'},
Expand All @@ -83,8 +84,7 @@ def test_list_instances_with_filters(self):
'transientGuestFlag': {'operation': False},
}
}
self.assert_called_with('SoftLayer_Account', 'getVirtualGuests',
filter=_filter)
self.assert_called_with('SoftLayer_Account', 'getVirtualGuests', filter=_filter)

def test_resolve_ids_ip(self):
_id = self.vs._get_ids_from_ip('172.16.240.2')
Expand Down

0 comments on commit b41158b

Please sign in to comment.